digitalmars.D.learn - Vibe.D - log requests and responses
- Saurabh Das (5/5) Nov 23 2016 Hi,
- Jacob Carlborg (17/20) Nov 23 2016 Yes. You can configure the logging on the HTTPServerSettings [1]
- Saurabh Das (3/17) Nov 24 2016 Thanks Jacob. That is precisely what I needed. :)
Hi, Is there an easy way to log all incoming requests and outgoing responses (and perhaps processing time, wait time, etc) in Vibe.D? Thanks, Saurabh
Nov 23 2016
On 2016-11-24 07:29, Saurabh Das wrote:Hi, Is there an easy way to log all incoming requests and outgoing responses (and perhaps processing time, wait time, etc) in Vibe.D?Yes. You can configure the logging on the HTTPServerSettings [1] instance. If you look at the documentation, the first four fields are related to logging. Use "accessLogFile" to set the filename of the log file. Use "accessLogFormat" to configure the log format. It uses the same syntax as Apache. Unfortunately the syntax is not documented in vibe.d and it doesn't implement all of the features that Apache has. I looked at the source code to figure out the format [2]. %D will give you the time taken to serve the request in milliseconds and %T in seconds. %t will give you the time stamp the request was received. I don't see anything related to waiting time. With the "accessLogger" field you can specify a custom logger. [1] http://vibed.org/api/vibe.http.server/HTTPServerSettings [2] https://github.com/rejectedsoftware/vibe.d/blob/master/http/vibe/http/log.d#L92 -- /Jacob Carlborg
Nov 23 2016
On Thursday, 24 November 2016 at 07:57:47 UTC, Jacob Carlborg wrote:On 2016-11-24 07:29, Saurabh Das wrote:Thanks Jacob. That is precisely what I needed. :)[...]Yes. You can configure the logging on the HTTPServerSettings [1] instance. If you look at the documentation, the first four fields are related to logging. Use "accessLogFile" to set the filename of the log file. Use "accessLogFormat" to configure the log format. It uses the same syntax as Apache. Unfortunately the syntax is not documented in vibe.d and it doesn't implement all of the features that Apache has. I looked at the source code to figure out the format [2]. %D will give you the time taken to serve the request in milliseconds and %T in seconds. %t will give you the time stamp the request was received. I don't see anything related to waiting time. [...]
Nov 24 2016