in reply to WWW::Mechanize::Chrome : random complaining that Log4perl is not initialised and test fails

I'm not sure that Log::Log4perl is a good logging mechanism, but all others seem equally bad to me.

  • Comment on Re: WWW::Mechanize::Chrome : random complaining that Log4perl is not initialised and test fails

Replies are listed 'Best First'.
Re^2: WWW::Mechanize::Chrome : random complaining that Log4perl is not initialised and test fails
by hippo (Archbishop) on Aug 12, 2025 at 09:24 UTC

    Have you looked at Log::Any? It's pretty lightweight, has sensible defaults and means that I, as the module writer, don't need to make any arbitrary decisions about how the user of my module wants their logging set up.


    🦛

Re^2: WWW::Mechanize::Chrome : random complaining that Log4perl is not initialised and test fails
by Arunbear (Prior) on Aug 12, 2025 at 10:23 UTC
    What's wrong with Log::Log4perl ?

      To me, Log::Log4perl requires a lot of configuration to set up properly and I feel it could do with more convenient ways to switch log-producing locations on and off.

      On the other hand, Log::Log4perl can be configured to separate out different logging messages and different logging sources into different output streams, so it's not all bad if you have a larger application of which WWW::Mechanize::Chrome is just a part.

        Huh. I've used Log::Log4perl at one client since 2018, and it's worked very well. Sure, turning logging up or down does require me to edit a file, but that's fine. I usually send INFO messages to the screen, but send DEBUG messages to the log, and ERROR messages go by E-Mail. I started to work on also getting ERRORs sent to Slack, but got busy with other stuff.

        The module also takes care of rotating the log files (size, number of backups to keep), which is super handy. I haven't tried any other logging modules because Log4perl does everything I need and Just Works.

        Alex / talexb / Toronto

        As of June 2025, Groklaw is back! This site was a really valuable resource in the now ancient fight between SCO and Linux. As it turned out, SCO was all hat and no cattle.Thanks to PJ for all her work, we owe her so much. RIP -- 2003 to 2013.

      IMHO It's less about what is wrong with Log4perl and more about what is wrong with releasing a CPAN module that depends on Log4perl. If WWW::Mechanize::Chrome had been built on Log::Any, this unit test would be able to plug it into (my) Log::Any::Adapter::TAP and have the log messages be an official part of the TAP stream. Meanwhile people using WWW::Mechanize::Chrome in production could plug it into Log4perl if they want really fancy logging and everyone goes home happy.

      Personally I never use Log4perl because I subscribe to daemontools philosophy that all logging of a service should stream through stderr and a separate dedicated logger process should read that pipe and handle all the advanced logic to sort/filter log messages. I like the separation of concerns better than trying to put advanced logging configuration into each perl service.