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 Sergiu Bivol <sb...@systematic.com> on 2007/02/21 18:05:24 UTC

Root logger appenders in log4j 1.3

Hi,

 

Our app, at start-up, configures using a 'bootstrap' log4j.boot.xml, and
then at a later point it re-configures using another log4j.xml. Both xml
files declare <root> logger with few appender references. 

 

With log4j 1.3 (alpha 8), we end up with messages going to all appenders
configured for <root> logger in BOTH xml files, contradicting the quote
below from the log4j manual. With log4j 1.2.*, messages get logged only to
the appenders specified in the last log4j.xml.

 

Is this a known issue or expected behaviour for log4j 1.3?

 

Thank you

 

QUOTE FROM MANUAL: "Similar to <logger> element, declaring a <root> element
will have the effect of first closing and then detaching all its current
appenders and only subsequently will referenced appenders, if any, will be
added. In particular, if it has no appender references, then the root logger
will lose all its appenders."

 


RE: Root logger appenders in log4j 1.3

Posted by Sergiu Bivol <sb...@systematic.com>.
It is "the Complete Log4j Manual" for as of v1.2.9, Dec, 2004, Page 68,
there is "<root> element" bullet at the bottom of the page.

Note that it says "Similar to the <logger> element, declaring <root> element
will have the effect...". So it is not an exception for <root> element.

And yes, I tried with v1.2.8, and it seems to do what this quote says. In
1.3, the behavior is different.

Regards
Sergiu

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: February 23, 2007 12:38 AM
To: Log4J Users List
Subject: Re: Root logger appenders in log4j 1.3


On Feb 22, 2007, at 11:15 PM, Jacob Kjome wrote:

>
> That's an interesting quote.  I have to admit that I haven't read  
> the Log4j manual and that's new to me.  In Log4j, reconfigurations  
> are genrally not destructive.  They are cumulative.  It sounds like  
> the manual is claiming that the ROOT logger is an exception to the  
> rule.
>
> Have you tried this with Log4j-1.2.xx?  Do you get the same results  
> or do you get the behavior described in the manual?  It's certainly  
> possible that this contract was broken in 1.3.
>
> Ceki, Curt, anyone, can you shed any light on this topic?  What's  
> the expected behavior?  Is the manual right, wrong, or just being  
> misinterpreted?
>
>
> Jake
>

My initial take was the same as yours.  The quote from "the manual"  
sounds incorrect but it is not in context.  I assume that they mean  
Ceki's "The complete log4j manual", but the don't specify precisely  
what "manual" they are referencing and a detailed reference would be  
handy.  I have an old beat up paperback copy, but didn't buy an  
electronic edition and the text may have been added in subsequent  
editions.

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


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


Re: Root logger appenders in log4j 1.3

Posted by Curt Arnold <ca...@apache.org>.
On Feb 22, 2007, at 11:15 PM, Jacob Kjome wrote:

>
> That's an interesting quote.  I have to admit that I haven't read  
> the Log4j manual and that's new to me.  In Log4j, reconfigurations  
> are genrally not destructive.  They are cumulative.  It sounds like  
> the manual is claiming that the ROOT logger is an exception to the  
> rule.
>
> Have you tried this with Log4j-1.2.xx?  Do you get the same results  
> or do you get the behavior described in the manual?  It's certainly  
> possible that this contract was broken in 1.3.
>
> Ceki, Curt, anyone, can you shed any light on this topic?  What's  
> the expected behavior?  Is the manual right, wrong, or just being  
> misinterpreted?
>
>
> Jake
>

My initial take was the same as yours.  The quote from "the manual"  
sounds incorrect but it is not in context.  I assume that they mean  
Ceki's "The complete log4j manual", but the don't specify precisely  
what "manual" they are referencing and a detailed reference would be  
handy.  I have an old beat up paperback copy, but didn't buy an  
electronic edition and the text may have been added in subsequent  
editions.

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


Re: Root logger appenders in log4j 1.3

Posted by James Stauffer <st...@gmail.com>.
You can use code to remove all appenders.

On 2/28/07, Sergiu Bivol <sb...@systematic.com> wrote:
> Anyone? Please advice on the configuration scenario in the previous message.
>
>
> In short, we'd like to log messages in a certain way (specified in a
> log4j.xml internal to our jar) when our app boots, and then at normal
> runtime log messages as configured by the user in an external log4j.xml.
>
> At this point, we can't find a way to override boot-time log4j configuration
> with log4j 1.3.
>
> Thank you
>
> -----Original Message-----
> From: Sergiu Bivol [mailto:sbivol@systematic.com]
> Sent: February 23, 2007 3:20 PM
> To: 'Log4J Users List'
> Subject: RE: Root logger appenders in log4j 1.3
>
> Hi,
>
> Yes, perhaps there are reasons to change it, but then help me understand how
> to configure log4j in the following scenario.
>
> We provide a log4.xml within our app's jar so that our application logs
> messages during startup (say to file1 and console). We also let the users
> specify a separate (external to our jars) log4j xml file to configure how
> the app should log messages after the startup phase (say file2 and console).
>
> With 1.2, this could be done by attaching the corresponding 2 appenders to
> the <root> element in each of the config files. How would I achieve the same
> behavior in 1.3? At this point, both file1 and file2 are growing, and every
> message is showing twice on the console.
>
> Thank you
> Sergiu
>
> -----Original Message-----
> From: Ceki Gülcü [mailto:listid@qos.ch]
> Sent: February 23, 2007 2:49 PM
> To: Log4J Users List; Log4J Users List
> Subject: Re: Root logger appenders in log4j 1.3
>
>
> Hello Jake et al,
>
> The complete log4j manual is correct as far as log4j 1.0, 1.1, 1.2 are
> concerned. However, in log4j 1.3 the behavior was changed because:
>
> 1) it is not what a user would expect without reading the docs (surprise
> element)
> 2) very few people seemed to take advantage of the "pre 1.3" behaviour**
>
> ** The "pre 1.3" behavior was intended to support partial config files
>
> The different behaviors should be transparent to the user as long as she
> does not do partial configs.
>
> I hope this helps,
>
> At 06:15 AM 2/23/2007, Jacob Kjome wrote:
>
> >That's an interesting quote.  I have to admit that I haven't read the
> >Log4j manual and that's new to me.  In Log4j, reconfigurations are
> >genrally not destructive.  They are cumulative.  It sounds like the manual
> >is claiming that the ROOT logger is an exception to the rule.
> >
> >Have you tried this with Log4j-1.2.xx?  Do you get the same results or do
> >you get the behavior described in the manual?  It's certainly possible
> >that this contract was broken in 1.3.
> >
> >Ceki, Curt, anyone, can you shed any light on this topic?  What's the
> >expected behavior?  Is the manual right, wrong, or just being
> misinterpreted?
> >
> >
> >Jake
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for
> Java.
> http://logback.qos.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
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: Root logger appenders in log4j 1.3

Posted by Sergiu Bivol <sb...@systematic.com>.
Anyone? Please advice on the configuration scenario in the previous message.


In short, we'd like to log messages in a certain way (specified in a
log4j.xml internal to our jar) when our app boots, and then at normal
runtime log messages as configured by the user in an external log4j.xml. 

At this point, we can't find a way to override boot-time log4j configuration
with log4j 1.3.

Thank you

-----Original Message-----
From: Sergiu Bivol [mailto:sbivol@systematic.com] 
Sent: February 23, 2007 3:20 PM
To: 'Log4J Users List'
Subject: RE: Root logger appenders in log4j 1.3

Hi,

Yes, perhaps there are reasons to change it, but then help me understand how
to configure log4j in the following scenario.

We provide a log4.xml within our app's jar so that our application logs
messages during startup (say to file1 and console). We also let the users
specify a separate (external to our jars) log4j xml file to configure how
the app should log messages after the startup phase (say file2 and console).

With 1.2, this could be done by attaching the corresponding 2 appenders to
the <root> element in each of the config files. How would I achieve the same
behavior in 1.3? At this point, both file1 and file2 are growing, and every
message is showing twice on the console.

Thank you
Sergiu

-----Original Message-----
From: Ceki Gülcü [mailto:listid@qos.ch] 
Sent: February 23, 2007 2:49 PM
To: Log4J Users List; Log4J Users List
Subject: Re: Root logger appenders in log4j 1.3


Hello Jake et al,

The complete log4j manual is correct as far as log4j 1.0, 1.1, 1.2 are 
concerned. However, in log4j 1.3 the behavior was changed because:

1) it is not what a user would expect without reading the docs (surprise 
element)
2) very few people seemed to take advantage of the "pre 1.3" behaviour**

** The "pre 1.3" behavior was intended to support partial config files

The different behaviors should be transparent to the user as long as she 
does not do partial configs.

I hope this helps,

At 06:15 AM 2/23/2007, Jacob Kjome wrote:

>That's an interesting quote.  I have to admit that I haven't read the 
>Log4j manual and that's new to me.  In Log4j, reconfigurations are 
>genrally not destructive.  They are cumulative.  It sounds like the manual 
>is claiming that the ROOT logger is an exception to the rule.
>
>Have you tried this with Log4j-1.2.xx?  Do you get the same results or do 
>you get the behavior described in the manual?  It's certainly possible 
>that this contract was broken in 1.3.
>
>Ceki, Curt, anyone, can you shed any light on this topic?  What's the 
>expected behavior?  Is the manual right, wrong, or just being
misinterpreted?
>
>
>Jake

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for
Java.
http://logback.qos.ch


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



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


RE: Root logger appenders in log4j 1.3

Posted by Sergiu Bivol <sb...@systematic.com>.
Hi,

Yes, perhaps there are reasons to change it, but then help me understand how
to configure log4j in the following scenario.

We provide a log4.xml within our app's jar so that our application logs
messages during startup (say to file1 and console). We also let the users
specify a separate (external to our jars) log4j xml file to configure how
the app should log messages after the startup phase (say file2 and console).

With 1.2, this could be done by attaching the corresponding 2 appenders to
the <root> element in each of the config files. How would I achieve the same
behavior in 1.3? At this point, both file1 and file2 are growing, and every
message is showing twice on the console.

Thank you
Sergiu

-----Original Message-----
From: Ceki Gülcü [mailto:listid@qos.ch] 
Sent: February 23, 2007 2:49 PM
To: Log4J Users List; Log4J Users List
Subject: Re: Root logger appenders in log4j 1.3


Hello Jake et al,

The complete log4j manual is correct as far as log4j 1.0, 1.1, 1.2 are 
concerned. However, in log4j 1.3 the behavior was changed because:

1) it is not what a user would expect without reading the docs (surprise 
element)
2) very few people seemed to take advantage of the "pre 1.3" behaviour**

** The "pre 1.3" behavior was intended to support partial config files

The different behaviors should be transparent to the user as long as she 
does not do partial configs.

I hope this helps,

At 06:15 AM 2/23/2007, Jacob Kjome wrote:

>That's an interesting quote.  I have to admit that I haven't read the 
>Log4j manual and that's new to me.  In Log4j, reconfigurations are 
>genrally not destructive.  They are cumulative.  It sounds like the manual 
>is claiming that the ROOT logger is an exception to the rule.
>
>Have you tried this with Log4j-1.2.xx?  Do you get the same results or do 
>you get the behavior described in the manual?  It's certainly possible 
>that this contract was broken in 1.3.
>
>Ceki, Curt, anyone, can you shed any light on this topic?  What's the 
>expected behavior?  Is the manual right, wrong, or just being
misinterpreted?
>
>
>Jake

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for
Java.
http://logback.qos.ch


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



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


Re: Root logger appenders in log4j 1.3

Posted by Ceki Gülcü <li...@qos.ch>.
Hello Jake et al,

The complete log4j manual is correct as far as log4j 1.0, 1.1, 1.2 are 
concerned. However, in log4j 1.3 the behavior was changed because:

1) it is not what a user would expect without reading the docs (surprise 
element)
2) very few people seemed to take advantage of the "pre 1.3" behaviour**

** The "pre 1.3" behavior was intended to support partial config files

The different behaviors should be transparent to the user as long as she 
does not do partial configs.

I hope this helps,

At 06:15 AM 2/23/2007, Jacob Kjome wrote:

>That's an interesting quote.  I have to admit that I haven't read the 
>Log4j manual and that's new to me.  In Log4j, reconfigurations are 
>genrally not destructive.  They are cumulative.  It sounds like the manual 
>is claiming that the ROOT logger is an exception to the rule.
>
>Have you tried this with Log4j-1.2.xx?  Do you get the same results or do 
>you get the behavior described in the manual?  It's certainly possible 
>that this contract was broken in 1.3.
>
>Ceki, Curt, anyone, can you shed any light on this topic?  What's the 
>expected behavior?  Is the manual right, wrong, or just being misinterpreted?
>
>
>Jake

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


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


Re: Root logger appenders in log4j 1.3

Posted by Jacob Kjome <ho...@visi.com>.
That's an interesting quote.  I have to admit that I haven't read the 
Log4j manual and that's new to me.  In Log4j, reconfigurations are 
genrally not destructive.  They are cumulative.  It sounds like the 
manual is claiming that the ROOT logger is an exception to the rule.

Have you tried this with Log4j-1.2.xx?  Do you get the same results 
or do you get the behavior described in the manual?  It's certainly 
possible that this contract was broken in 1.3.

Ceki, Curt, anyone, can you shed any light on this topic?  What's the 
expected behavior?  Is the manual right, wrong, or just being misinterpreted?


Jake

At 11:05 AM 2/21/2007, you wrote:
 >Hi,
 >
 >
 >
 >Our app, at start-up, configures using a 'bootstrap' log4j.boot.xml, and
 >then at a later point it re-configures using another log4j.xml. Both xml
 >files declare <root> logger with few appender references.
 >
 >
 >
 >With log4j 1.3 (alpha 8), we end up with messages going to all appenders
 >configured for <root> logger in BOTH xml files, contradicting the quote
 >below from the log4j manual. With log4j 1.2.*, messages get logged only to
 >the appenders specified in the last log4j.xml.
 >
 >
 >
 >Is this a known issue or expected behaviour for log4j 1.3?
 >
 >
 >
 >Thank you
 >
 >
 >
 >QUOTE FROM MANUAL: "Similar to <logger> element, declaring a <root> element
 >will have the effect of first closing and then detaching all its current
 >appenders and only subsequently will referenced appenders, if any, will be
 >added. In particular, if it has no appender references, then the root logger
 >will lose all its appenders."
 >
 >


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