use Log::Log4perl qw(get_logger :nowarn);
...
get_logger->info("Shit happens");
IMHO when you have decided to use Log::Log4perl then it is in the installation prerequisites.
To have a function name like 'get_logger' is unique enough for loading it in your current namespace. When Log::Log4perl is not initialized, the code doesn't hurt. So, whenever I need an additional log statement, I just insert get_logger->error("Somewhat");
That what I meant with 'elegant'. Or call is 'handy'.
What is your solution to those cross cutting concerns like logging?
Best regards
McA | [reply] [d/l] [select] |
What is your solution to those cross cutting concerns like logging?
What is logging? Simply stated, it is printing to a filehandle.
Pretty much everyone is comfortable using STDOUT and STDERR. And STDERR serves all my logging needs.
But if you want your logging to go to a different place than STDERR, what's wrong with (say) STDLOG?
Point it to a file or port as needed.
Want to turn logging off, direct it to the null device.
Want your logging to add boilerplate (timestamps, callstack, threadids etc.), tie *STDLOG.
Once it is tied, routing to multiple destinations is easy.
IMO, L::L4p is a "let's pretend we're java bunnies", grandiose overkill, behemoth of a package dynasty of packages, that makes writing a few bits of text to a file, laborious, complicated and expensive.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
| [reply] |
| [reply] |