开发者

Rack Request Log

开发者 https://www.devze.com 2023-01-05 15:25 出处:网络
Why 开发者_如何学Python Is there a reason Rack\'s request log by default outputs to stderr? If i\'m not mistaken, the request log is Rack::CommonLogger which according to the RDoc:

Why

开发者_如何学Python

Is there a reason Rack's request log by default outputs to stderr? If i'm not mistaken, the request log is Rack::CommonLogger which according to the RDoc:

forwards every request to an app given, and logs a line in the Apache common log format to the logger, or rack.errors by default.

Doesn't it make more sense to have an access and error request log instead of pushing everything to rack.errors?

How

How does one redirect the request log to a file? All examples I came across are specifically for sinatra. Can it be disabled completely? (redirect to /dev/null?)


I have the same question. But I hack a little this logger to switch logger like I want.

You can see the code here :

http://github.com/shingara/sinatra-request-logger/blob/master/lib/sinatra/request-logger.rb

Rack::CommonLogger use rack.errors where there are data. It's a StringIO by default. So you can't put a Logger inside. You need made a Proxy to put in your logger.

0

精彩评论

暂无评论...
验证码 换一张
取 消