Log::Dispatch vs Log4perl?

sigzero on 2006-02-06T16:40:32

Which do you use and why? The both attempt to be the "one stop shop" for logging.


Log4perl

Lecar_red on 2006-02-06T18:02:27

I choose log4perl for two main reasons:

  • We have ops folks and it's logging configuration seemed to be most friendly to ops folks, especially those already accustomed to log4j.
  • It is very flexible. It was very easy to add custom format values (MDC is the log4perl term). For example, in a web application the session id was added as a MDC value for all logging that was part of the a request across all internal components. This made it much easier to debug web request across multiple modules. Also, it was very straight forward to add custom logging appender. (the thing that does the actually logging). In my case, I added one to make special sub directories for logfiles under certain conditions making it easier to debug.

To be honest, I didn't really look to much at Log::Dispatch and don't know much about it.

Also, MikeS is really great at providing help (on the mailing list) and fixing issues. (thanks Mike)

have your cake and eat it with log4perl

TeeJay on 2006-02-06T20:15:15

Log4perl lets you have your cake and eat it - you can use log4j configurations and use Log::Dispatch dispatchers.

There is a very good article at perl.com

Both work fine

bluto on 2006-02-07T16:32:32

I've used Log::Dispatch for a long time and looked into switching to Log4perl. Both seemed fine for my needs.

The main reason I didn't switch at the time was because I realized that Log4perl's config required too much knowledge of the app's internals (e.g. class layout, I think) for our admins to alter. It's probably more of an admin problem than a Log4perl problem. Since I needed to write a simpler config front-end for it anyway there seemed little reason for me to use one over the other. I stuck with what I knew worked in production (Log::Dispatch), but I actually tested running it on top of Log4perl without a problem.

FWIW, during testing the Log4perl folks were very responsive and added a feature I requested surprisingly quickly (IIRC somthing that Log::Dispatch had). I almost feel guilty for not using it now...

Re:Both work fine

Perlmeister on 2006-02-16T18:30:58

The main reason I didn't switch at the time was because I realized that Log4perl's config required too much knowledge of the app's internals (e.g. class layout, I think)
Actually, that's up for you to decide.

To enable logging in particular areas of an application, you can use the class structure. But that's just a feature and not required at all.

Instead, you can just enable/disable logging of the overall application or choose entirely different categories (i.e. make up your own hierarchy). The class structure is just often the most natural way of subdividing an application.