Perl: the Markov chain saw | |
PerlMonks |
Re: Accessing Log::Log4perl Configuration Valuesby whereiskurt (Friar) |
on Mar 18, 2007 at 19:07 UTC ( [id://605380]=note: print w/replies, xml ) | Need Help?? |
I'm feeling some sort of 'O'Reilly tribute' <Saint Patty's just passed> Happy St. Patty's (I'm actually a tad late, somewhere)I have always found that to be an excellent log4perl article series, but as I refer to it I can't seem to see any reference to it. Here's a better source: Variable Substitution (are you not a troll? :L) " To avoid having to retype the same expressions over and over again, Log::Log4perl's configuration files support simple variable substitution. New variables are defined simply by adding
lines to the configuration file before using afterwards to recall the assigned values. Here's an example:
This is a convenient way to define two appenders with the same layout without having to retype the pattern definitions. Update: After rereading your post (I tend to do that) I think that perhaps this more inline with what you're getting at. This is analagous to writing log4perl eval statment - pick your favourite Templater for flavour. Kurt Dirty Tricks Example (Sorry about the Troll comment :)) A simple example to cut-and-paste and get started:
This will log something like:
to the log file 'test.log', which Log4perl will append to or create it if it doesn't exist already.
In Section
Seekers of Perl Wisdom
|
|