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 Lutz Michael <mi...@siemens.com> on 2003/02/18 20:08:04 UTC

Knowing if doConfigure was called


My department creates components used by applications, some of which use
Log4j and some of which do not.  If Log4j is used, we don't want to
"reconfigure" Log4j in our components because we may inadvertently overwrite
configuration settings made by applications.  We'd just like to piggy-back
off their configuration, but we have to leave the door open to those
applications not using Log4j.

Is it possible to know if doConfigure was called (either from
DOMConfigurator or PropertyConfigurator), or is there a sneaky way in
general to figure out if Log4j "has been configured"?

We're just trying to avoid redundantly configuring Log4j in a distributed
development environment.

Mike

PS We have the same sort of issue with MDC, in this case we can just check
for null for each key.

-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
Health Services Corporation and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you

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


Re: Knowing if doConfigure was called

Posted by Ceki Gülcü <ce...@qos.ch>.
This usually works although it assumes that the configuration is done on 
root which is not necessarily always the case!

At 16:13 18.02.2003 -0300, you wrote:
>We use
>
>boolean wasConfigured =
>Logger.getRoot().getAllAppenders().hasMoreElements();
>
>[]'s
>Daniel Serodio
>
>On Tue, 2003-02-18 at 16:08, Lutz Michael wrote:
> > My department creates components used by applications, some of which use
> > Log4j and some of which do not.  If Log4j is used, we don't want to
> > "reconfigure" Log4j in our components because we may inadvertently 
> overwrite
> > configuration settings made by applications.  We'd just like to piggy-back
> > off their configuration, but we have to leave the door open to those
> > applications not using Log4j.
> >
> > Is it possible to know if doConfigure was called (either from
> > DOMConfigurator or PropertyConfigurator), or is there a sneaky way in
> > general to figure out if Log4j "has been configured"?
> >
> > We're just trying to avoid redundantly configuring Log4j in a distributed
> > development environment.
> >
> > Mike
> >
> > PS We have the same sort of issue with MDC, in this case we can just check
> > for null for each key.
> >
> > 
> -------------------------------------------------------------------------------
> > This message and any included attachments are from Siemens Medical 
> Solutions
> > Health Services Corporation and are intended only for the addressee(s).
> > The information contained herein may include trade secrets or 
> privileged or
> > otherwise confidential information.  Unauthorized review, forwarding, 
> printing,
> > copying, distributing, or using such information is strictly prohibited 
> and may
> > be unlawful.  If you received this message in error, or have reason to 
> believe
> > you are not authorized to receive it, please promptly delete this 
> message and
> > notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>--
>Daniel Serodio <da...@checkforte.com.br>
>CheckForte
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

--
Ceki 


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


Re: Knowing if doConfigure was called

Posted by Daniel Serodio <da...@checkforte.com.br>.
We use

boolean wasConfigured =
Logger.getRoot().getAllAppenders().hasMoreElements();

[]'s
Daniel Serodio

On Tue, 2003-02-18 at 16:08, Lutz Michael wrote:
> My department creates components used by applications, some of which use
> Log4j and some of which do not.  If Log4j is used, we don't want to
> "reconfigure" Log4j in our components because we may inadvertently overwrite
> configuration settings made by applications.  We'd just like to piggy-back
> off their configuration, but we have to leave the door open to those
> applications not using Log4j.
> 
> Is it possible to know if doConfigure was called (either from
> DOMConfigurator or PropertyConfigurator), or is there a sneaky way in
> general to figure out if Log4j "has been configured"?
> 
> We're just trying to avoid redundantly configuring Log4j in a distributed
> development environment.
> 
> Mike
> 
> PS We have the same sort of issue with MDC, in this case we can just check
> for null for each key.
> 
> -------------------------------------------------------------------------------
> This message and any included attachments are from Siemens Medical Solutions 
> Health Services Corporation and are intended only for the addressee(s).  
> The information contained herein may include trade secrets or privileged or 
> otherwise confidential information.  Unauthorized review, forwarding, printing, 
> copying, distributing, or using such information is strictly prohibited and may 
> be unlawful.  If you received this message in error, or have reason to believe 
> you are not authorized to receive it, please promptly delete this message and 
> notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
-- 
Daniel Serodio <da...@checkforte.com.br>
CheckForte


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