Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 34400
Status: resolved
Priority: 0/
Queue: Log-Log4perl

People
Owner: Nobody in particular
Requestors: jgangemi@gmail.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.15
Fixed in: (no value)



Subject: allow category levels to be redefined
we have written our logger integration code to look for an external configuration file that allows additional appenders to be specified and would also like to be able to override log levels that have been previously defined. the attached patch allows provides this functionality.
Subject: PropertyConfigurator.diff
Index: PropertyConfigurator.pm =================================================================== RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Config/PropertyConfigurator.pm,v retrieving revision 1.13 diff -r1.13 PropertyConfigurator.pm 101c101 < if(defined $ptr->{value}) { --- > if(defined $ptr->{value} && defined $parts[0] && $parts[0] ne 'category') {
On Mon Mar 24 11:08:29 2008, JAE wrote: Show quoted text
> we have written our logger integration code to look for an external > configuration file that allows additional appenders to be specified and > would also like to be able to override log levels that have been > previously defined. > > the attached patch allows provides this functionality.
Sorry for the delay. I'm not sure I understand the implications of this patch, can you give me an example on what kind of configuration syntax you're enabling with it? -- Mike
On Sat Aug 23 23:27:56 2008, MSCHILLI wrote: Show quoted text
> On Mon Mar 24 11:08:29 2008, JAE wrote:
> > we have written our logger integration code to look for an external > > configuration file that allows additional appenders to be specified and > > would also like to be able to override log levels that have been > > previously defined. > > > > the attached patch allows provides this functionality.
> > Sorry for the delay. I'm not sure I understand the implications of this > patch, can you give me an example on what kind of configuration syntax > you're enabling with it? > > -- Mike > >
sure, basically i can do things like this: #log4perl.appender.master.delegate = socket log4perl.appender.socket = Log::Log4perl::Appender::Socket log4perl.appender.socket.PeerAddr = 10.100.3.114 log4perl.appender.socket.PeerPort = 4448 log4perl.appender.socket.silent_recovery = 1 log4perl.appender.socket.layout = GA::Util::Log::Layout::LayoutDecorator log4perl.appender.socket.layout.decorate = Log::Log4perl::Layout::XMLLayout log4perl.appender.socket.layout.decorate.LocationInfo = true where if that appender was enabled, it the socket appender would start getting messages sent to it. also - if my 'master' config has a setting that sets some category to the 'trace' level, i can override that category in my external config file rather then editing the 'master' configuration.
On Mon Aug 25 10:11:14 2008, JAE wrote: Show quoted text
> sure, basically i can do things like this: > #log4perl.appender.master.delegate = socket > log4perl.appender.socket = Log::Log4perl::Appender::Socket
Maybe I'm dense today, but are you sure the patch in comment #1 and this go together? The patch seems to suppress a warning when the same value in the conf file gets overwritten -- can you explain how this is related to the master appender? Also, I don't understand what you mean by 'external configuration file', maybe you could go into a bit more detail on how the pieces fit together? -- Mike
On Tue Aug 26 02:00:55 2008, MSCHILLI wrote: Show quoted text
> On Mon Aug 25 10:11:14 2008, JAE wrote:
> > sure, basically i can do things like this: > > #log4perl.appender.master.delegate = socket > > log4perl.appender.socket = Log::Log4perl::Appender::Socket
> > Maybe I'm dense today, but are you sure the patch in comment #1 and this > go together? The patch seems to suppress a warning when the same value > in the conf file gets overwritten -- can you explain how this is related > to the master appender? > > Also, I don't understand what you mean by 'external configuration file', > maybe you could go into a bit more detail on how the pieces fit together? > > -- Mike
oh - right...in our environment, we set warnings == fatal, so those redefined messages cause our code to break. as for the external config file, basically we have a perl module that contains our primary log4perl configuration, so when the code base is loaded, the config is pulled from that module. right before log4perl is actually initialized, i check to see if there is an external config file on disk, and if there is, i append it to the 'master' configuration and then pass that to log4perl. that allows me to override one of the categories that has been defined in the 'master' config file, as well define additional appenders that i may want to use, etc.
Sorry for the long wait, there's a new :nostrict target that now allows redefining categories and other configuration items: http://github.com/mschilli/log4perl/commit/99d62ae641400839fbc9923855e5fb725a1a8b1e Thanks for your contribution. -- Mike