Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] clogger 0.0.4 - configurable request logging for Rack

Reply
Thread Tools

[ANN] clogger 0.0.4 - configurable request logging for Rack

 
 
Eric Wong
Guest
Posts: n/a
 
      09-02-2009
* http://clogger.rubyforge.org/
*
* git://git.bogomips.org/clogger.git

Clogger is Rack middleware for logging HTTP requests. The log format
is customizable so you can specify exactly which fields to log.

Changes:

### 0.0.4 / 2009-09-02

The pure Ruby version now escapes with uppercase A-F
characters to match nginx log output. There are now extra
checks against badly behaving Rack applications and 500
errors will be logged before TypeError is raised if the
application response does not conform (minimally) to Rack
expectations. Finally, handling of $request (requests
without "HTTP_VERSION" set in the Rack env) should now be
logged correctly without unnecessary trailing characters.

Hackers: the primary git repository has been moved to
git://git.bogomips.org/clogger.git for now since I'm having
issues with pushing to Rubyforge (seems related to Support
Requests item #26185).

--
Eric Wong

 
Reply With Quote
 
 
 
 
Iñaki Baz Castillo
Guest
Posts: n/a
 
      09-02-2009
2009/9/2 Eric Wong <>:
> * http://clogger.rubyforge.org/
> *
> * git://git.bogomips.org/clogger.git
>
> Clogger is Rack middleware for logging HTTP requests. =C2=A0The log forma=

t
> is customizable so you can specify exactly which fields to log.



Is it possible to make Clogger using Logging class?



--=20
I=C3=B1aki Baz Castillo
<>

 
Reply With Quote
 
 
 
 
Eric Wong
Guest
Posts: n/a
 
      09-02-2009
Iñaki Baz Castillo <> wrote:
> 2009/9/2 Eric Wong <>:
> > * http://clogger.rubyforge.org/
> > *
> > * git://git.bogomips.org/clogger.git
> >
> > 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, you can specify anything that responds to
"<<" as your :logger parameter:

use Clogger, :logger => Logger.new("/path/to/log")

--
Eric Wong

 
Reply With Quote
 
Iñaki Baz Castillo
Guest
Posts: n/a
 
      09-02-2009
El Mi=C3=A9rcoles, 2 de Septiembre de 2009, Eric Wong escribi=C3=B3:
> > > 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?

>=20
> 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 th=
e=20
design of Java=E2=80=98s log4j library. It features a hierarchical logging =
system,=20
custom level names, multiple output destinations per log event, custom=20
formatting, and more."


> you can specify anything that responds to
> "<<" as your :logger parameter:
>=20
> use Clogger, :logger =3D> Logger.new("/path/to/log")


How to set the Logger debug level there?


Thanks a lot.


=2D-=20
I=C3=B1aki Baz Castillo <>

 
Reply With Quote
 
Eric Wong
Guest
Posts: n/a
 
      09-02-2009
Iñaki Baz Castillo <> wrote:
> 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."


It seems to support the "<<" parameter, so I would say yes, it does
work. If you run into any issues, let me know.

> > 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?


You can always create the object first and set whatever options you want:

logger = Logger.new("/path/to/log")
logger.level = Logger:EBUG
use Clogger, :logger => logger

Of course, the "<<" method Clogger uses internally bypasses level checks
in Logger (same as Rack::CommonLogger)

--
Eric Wong

 
Reply With Quote
 
Iñaki Baz Castillo
Guest
Posts: n/a
 
      09-02-2009
El Mi=C3=A9rcoles, 2 de Septiembre de 2009, I=C3=B1aki Baz Castillo escribi=
=C3=B3:
> El Mi=C3=A9rcoles, 2 de Septiembre de 2009, Eric Wong escribi=C3=B3:
> > > > Clogger is Rack middleware for logging HTTP requests. The log form=

at
> > > > 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,

>=20
> No, I mean Logging:
>=20
> http://logging.rubyforge.org/
>=20
> "Logging is a flexible logging library for use in Ruby programs based on
> the design of Java=E2=80=98s log4j library. It features a hierarchical l=

ogging
> system, custom level names, multiple output destinations per log event,
> custom formatting, and more."
>=20
> > you can specify anything that responds to
> > "<<" as your :logger parameter:
> >
> > use Clogger, :logger =3D> Logger.new("/path/to/log")

>=20
> How to set the Logger debug level there?


=46or example, Logging has "<<" method, but it's a limited one:

=2D--------------------------------------------
log << "message"
=20
Log the given message without any formatting and without performing any lev=
el=20
checks. The message is logged to all appenders. The message is passed up th=
e=20
logger tree if this logger=E2=80=98s additivity is true.
=2D--------------------------------------------




=2D-=20
I=C3=B1aki Baz Castillo <>

 
Reply With Quote
 
Eric Wong
Guest
Posts: n/a
 
      09-02-2009
Eric Wong <> wrote:
> It seems to support the "<<" parameter, so I would say yes, it does


s/parameter/method/, of course

--
Eric Wong

 
Reply With Quote
 
Eric Wong
Guest
Posts: n/a
 
      09-02-2009
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

--
Eric Wong

 
Reply With Quote
 
Iñaki Baz Castillo
Guest
Posts: n/a
 
      09-02-2009
El Mi=C3=A9rcoles, 2 de Septiembre de 2009, Eric Wong escribi=C3=B3:
> I=C3=B1aki Baz Castillo <> wrote:
> > El Mi=C3=A9rcoles, 2 de Septiembre de 2009, I=C3=B1aki Baz Castillo esc=

ribi=C3=B3:
> > > El Mi=C3=A9rcoles, 2 de Septiembre de 2009, Eric Wong escribi=C3=B3:
> > > > > > 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=E2=80=98s log4j library. It features a hierarch=

ical
> > > 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 =3D> 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=E2=80=98s additivity is true.
> > ---------------------------------------------

>=20
> 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)).
>=20
> 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].
>=20
>=20
> [1] - which doesn't work if you're using multiple processes anyways,
> logrotate is a better solution.
>=20
> [2] - which means you lose data if your application dies unexpectedly
>=20


Thanks for the explanation.

=2D-=20
I=C3=B1aki Baz Castillo <>

 
Reply With Quote
 
Iñaki Baz Castillo
Guest
Posts: n/a
 
      09-02-2009
El Mi=C3=A9rcoles, 2 de Septiembre de 2009, Eric Wong escribi=C3=B3:

> 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)).
>=20
> 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].


What I want to achieve are unified logs (same file and same format).
I've already set my Logging instance (for manual logging) and want that Rac=
k=20
via Clogger (and also DataMapper) uses the same file and same format.

I expect that I just must configure (or code) the format both Clogger and=20
DataMapper use when invoking "<<" method, right?

The fact is I've already both Clogger and DataMapper logging via the Loggin=
g=20
instance (so to the same file), I just need to edit the format to make it=20
match,


>=20
> [1] - which doesn't work if you're using multiple processes anyways,
> logrotate is a better solution.


Yes, I always use Linux logrotate system rather than the built-in applicati=
on=20
log rotation.
=20


Thanks a lot.


=2D-=20
I=C3=B1aki Baz Castillo <>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] clogger 1.0.0 - configurable request logging for Rack Eric Wong Ruby 0 04-21-2011 05:54 AM
[ANN] clogger 0.7.0 - configurable request logging for Rack Eric Wong Ruby 0 01-15-2011 12:46 AM
[ANN] clogger 0.0.7 - configurable request logging for Rack Eric Wong Ruby 0 09-09-2009 05:25 PM
[ANN] clogger 0.0.6 - configurable request logging for Rack Eric Wong Ruby 0 09-08-2009 12:17 AM
[ANN] clogger 0.0.5 - configurable request logging for Rack Eric Wong Ruby 0 09-03-2009 02:01 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57