On Tue, 9 Oct 2007, Jonathan Swartz wrote:

> Let's say I've got several file appenders and a screen appender, and
> I want them to use the same layout.

There's no inheritance available (yet), but variable substitution should
ease your pain at least a little bit:

    http://log4perl.sourceforge.net/d/Log/Log4perl.html#bd632

-- Mike

Mike Schilli
[EMAIL PROTECTED]

>
>     log4perl.appender.foofile = Log::Log4perl::Appender::File
>     log4perl.appender.foofile.filename = logs/foo.log
>     log4perl.appender.foofile.mode = append
>     log4perl.appender.foofile.layout = PatternLayout
>     log4perl.appender.foofile.layout.ConversionPattern = %d{dd/MMM/
> yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n
>
>     log4perl.appender.barfile = Log::Log4perl::Appender::File
>     log4perl.appender.barfile.filename = logs/bar.log
>     log4perl.appender.barfile.mode = append
>     log4perl.appender.barfile.layout = PatternLayout
>     log4perl.appender.barfile.layout.ConversionPattern = %d{dd/MMM/
> yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n
>
>     log4perl.appender.screen = Log::Log4perl::Appender::Screen
>     log4perl.appender.screen.layout = PatternLayout
>     log4perl.appender.screen.layout.ConversionPattern = %d{dd/MMM/
> yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n
>
> This is rather tedious, to say the least. Is there any way to
> abbreviate this in the config file, e.g. to specify common properties
> of my standard appender and have the other appenders "inherit" from
> it? Or do I have to resort to configuring from a hash if I want this
> kind of expressiveness?
>
> Thanks
> Jon
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> log4perl-devel mailing list
> log4perl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to