Iñaki Baz Castillo <ibc / aliax.net> 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 -- Eric Wong