logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: Log4j configuration
Date Wed, 28 Jul 2010 17:39:12 GMT
On Wed, 28 Jul 2010 10:27:24 -0700 (PDT)
  mokader <mokader@cisco.com> wrote:
> 
> Thanks Jake,
> 
> Is there any way to override the configuration or remove the existing
> appenders.
> 

Yes, appenders can be removed manually by traversing the logging API.  But, 
again, it seems like there was some way to tell Log4j not to be cumulative (at 
least I hope so).  Hopefully someone else can shed light on this possibility.

> would the  call to LogManager.shutdown()and then
> DOMConfigurator.configure(initUrl) work. 

I've never tested it.  You should try it and report results.

Jake

> 
> Thanks in advance,
> Mohammed
> 
> 
> Jacob Kjome wrote:
>> 
>> Log4j configuration is cumulative.  One call to configure() does not
>> override 
>> another.  Instead, the configurations are combined.  Each time you
>> configure() 
>> on a config file that defines an appender, a new one will be added rather
>> than 
>> blow away the old one.  Therefore you get duplicate logging as more than
>> one 
>> appender is active.
>> 
>> That said, it seems like this behavior was configurable?  Or maybe we
>> merely 
>> discussed it a while back since the default behavior is somewhat
>> surprising to 
>> users?  Maybe one of the other Log4j developers recalls this discussion
>> and 
>> can provide details?
>> 
>> 
>> Jake
>> 
>> 
>> On Wed, 28 Jul 2010 03:17:25 -0700 (PDT)
>>   mokader <mokader@cisco.com> wrote:
>>> 
>>> Hi,
>>> 
>>> I am adding logging enhancement to my app. There is already a log4j
>>> wrapper
>>> is available in my app. But the existing is in jar and I can not modify.
>>> The
>>> problem is, now I have two log4j.xml file. one for my enhancement and
>>> other
>>> for existing one.
>>> 
>>> I first initialize existing log4j wrapper, it uses
>>> DOMConfigurator.configure(initUrl) to configure. After this I call my new
>>> APIs, I follow the same DOMConfigurator.configure(initUrl) to override
>>> the
>>> configuration.
>>> 
>>> The problem here is, I have custom appender, which I specified in
>>> log4j.xml
>>> of my enhancement, but the custom appender is called twice - once from
>>> existing APIs and another from my APIs. 
>>> 
>>> I dont know how log4j is invoking my custom appeder, when existing APIs
>>> are
>>> initialized. I looked this from stack trace.
>>> -- 
>>> View this message in context: 
>>>http://old.nabble.com/Log4j-configuration-tp29285028p29285028.html
>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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
>> 
>> 
>> 
> 
> -- 
> View this message in context: 
>http://old.nabble.com/Log4j-configuration-tp29285028p29289033.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message