From: "Iñaki Baz Castillo" Date: 2009-09-03T05:51:11+09:00 Subject: Re: [ANN] clogger 0.0.4 - configurable request logging for Rack El Miércoles, 2 de Septiembre de 2009, Eric Wong escribió: > Iñaki Baz Castillo wrote: > > El Miércoles, 2 de Septiembre de 2009, Iñaki Baz Castillo escribió: > > > El Miércoles, 2 de Septiembre de 2009, Eric Wong escribió: > > > > > > Clogger is Rack middleware for logging HTTP requests. The log > > > > > > format is customizable so you can specify exactly which fields to > > > > > > log. > > > > > > > > > > Is it possible to make Clogger using Logging class? > > > > > > > > If you mean Logger, then yes, > > > > > > No, I mean Logging: > > > > > > http://logging.rubyforge.org/ > > > > > > "Logging is a flexible logging library for use in Ruby programs based > > > on the design of Java‘s log4j library. It features a hierarchical > > > logging system, custom level names, multiple output destinations per > > > log event, custom formatting, and more." > > > > > > > you can specify anything that responds to > > > > "<<" as your :logger parameter: > > > > > > > > use Clogger, :logger => Logger.new("/path/to/log") > > > > > > How to set the Logger debug level there? > > > > For example, Logging has "<<" method, but it's a limited one: > > > > --------------------------------------------- > > log << "message" > > > > Log the given message without any formatting and without performing any > > level checks. The message is logged to all appenders. The message is > > passed up the logger tree if this logger‘s additivity is true. > > --------------------------------------------- > > For request logging, the point of using "<<" is to avoid formatting done > by the Logger. Both Rack::CommonLogger and Clogger already do their own > timestamps and other formatting features (Clogger being highly > configurable)). > > So you really don't get much benefit from using any Logging/Logger > object over a File object unless you need builtin log rotation[1] > or you want userspace buffering[2]. > > > [1] - which doesn't work if you're using multiple processes anyways, > logrotate is a better solution. > > [2] - which means you lose data if your application dies unexpectedly > Thanks for the explanation. -- Iñaki Baz Castillo