You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Paolo Bacci <pa...@longadata.com> on 2006/12/27 19:15:29 UTC

Appenders

Hi all,


I'm having problems writing to multiple appenders.
I made a log4j.properties and I'd like it to write to 2 different log files,
but it seems like nothing works....
I'm doing this on my .properties:


        log4j.rootLogger=all, stdout, R, html
>         log4j.secondAppender=INHERITED, app



#### App appender properties
> log4j.appender.app=org.apache.log4j.RollingFileAppender
> log4j.appender.app.File=/tmp/log.log
>
> # Control the maximum log file size
> log4j.appender.app.MaxFileSize=100KB
> # Archive log files (one backup file here)
> log4j.appender.app.MaxBackupIndex=1
>
> log4j.appender.app.layout=org.apache.log4j.PatternLayout
> log4j.appender.app.layout.ConversionPattern=%d:%-5r %-5p[%t | %c{1}:%L |
> %M] %m%n
>




Rootlogger is doing great, but the second one is just not doing anything at
all.
Does anybody has any clue about why is it happening?


thanks in advance
Paolo

Re: Appenders

Posted by "Andepiel S.L." <an...@hotmail.com>.

  Hi,

    I have worked with this class for logging. On a client-server 
environment, creates 1 log per client. I don't remember internally how 
it works, but you can check it out, if it helps.

    Root logger configuration is based on "log4j-conf.xml", the rest are 
based on root config, but some properties can be changed dynamically, 
such as layout (XML, HTML, plain text, ...).

    With javadoc you can generate the documentation of it.

    César

===================

Paolo Bacci escribió:
> Hi all,
>
>
> I'm having problems writing to multiple appenders.
> I made a log4j.properties and I'd like it to write to 2 different log 
> files,
> but it seems like nothing works....
> I'm doing this on my .properties:
>
>
>        log4j.rootLogger=all, stdout, R, html
>>         log4j.secondAppender=INHERITED, app
>
>
>
> #### App appender properties
>> log4j.appender.app=org.apache.log4j.RollingFileAppender
>> log4j.appender.app.File=/tmp/log.log
>>
>> # Control the maximum log file size
>> log4j.appender.app.MaxFileSize=100KB
>> # Archive log files (one backup file here)
>> log4j.appender.app.MaxBackupIndex=1
>>
>> log4j.appender.app.layout=org.apache.log4j.PatternLayout
>> log4j.appender.app.layout.ConversionPattern=%d:%-5r %-5p[%t | %c{1}:%L |
>> %M] %m%n
>>
>
>
>
>
> Rootlogger is doing great, but the second one is just not doing 
> anything at
> all.
> Does anybody has any clue about why is it happening?
>
>
> thanks in advance
> Paolo
>


Re: Appenders

Posted by James Stauffer <st...@gmail.com>.
Where do you define your stdout, R, and html appenders?

On 12/27/06, Paolo Bacci <pa...@longadata.com> wrote:
> Hi all,
>
>
> I'm having problems writing to multiple appenders.
> I made a log4j.properties and I'd like it to write to 2 different log files,
> but it seems like nothing works....
> I'm doing this on my .properties:
>
>
>         log4j.rootLogger=all, stdout, R, html
> >         log4j.secondAppender=INHERITED, app
>
>
>
> #### App appender properties
> > log4j.appender.app=org.apache.log4j.RollingFileAppender
> > log4j.appender.app.File=/tmp/log.log
> >
> > # Control the maximum log file size
> > log4j.appender.app.MaxFileSize=100KB
> > # Archive log files (one backup file here)
> > log4j.appender.app.MaxBackupIndex=1
> >
> > log4j.appender.app.layout=org.apache.log4j.PatternLayout
> > log4j.appender.app.layout.ConversionPattern=%d:%-5r %-5p[%t | %c{1}:%L |
> > %M] %m%n
> >
>
>
>
>
> Rootlogger is doing great, but the second one is just not doing anything at
> all.
> Does anybody has any clue about why is it happening?
>
>
> thanks in advance
> Paolo
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Appenders

Posted by "Andepiel S.L." <an...@hotmail.com>.
   Using the XML config file attach properly several appenders to the 
same logger. I am sure there is another way using properties files, 
meanwhile you can try to use XML config file.

César

==========

Paolo Bacci escribió:
> Hi all,
>
>
> I'm having problems writing to multiple appenders.
> I made a log4j.properties and I'd like it to write to 2 different log 
> files,
> but it seems like nothing works....
> I'm doing this on my .properties:
>
>
>        log4j.rootLogger=all, stdout, R, html
>>         log4j.secondAppender=INHERITED, app
>
>
>
> #### App appender properties
>> log4j.appender.app=org.apache.log4j.RollingFileAppender
>> log4j.appender.app.File=/tmp/log.log
>>
>> # Control the maximum log file size
>> log4j.appender.app.MaxFileSize=100KB
>> # Archive log files (one backup file here)
>> log4j.appender.app.MaxBackupIndex=1
>>
>> log4j.appender.app.layout=org.apache.log4j.PatternLayout
>> log4j.appender.app.layout.ConversionPattern=%d:%-5r %-5p[%t | %c{1}:%L |
>> %M] %m%n
>>
>
>
>
>
> Rootlogger is doing great, but the second one is just not doing 
> anything at
> all.
> Does anybody has any clue about why is it happening?
>
>
> thanks in advance
> Paolo
>