logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: configure programmatically if properties not found, how to?
Date Mon, 14 Apr 2003 12:53:12 GMT

One option is for you tocheck the log4j common questions wiki page for
how to see if log4j is configured.  Use this code to see if log4j is
configured.  If it's not configured, you can then do your programmatic

Another option is to see if you can get the log4j.configuration system
property, i.e. System.getProperty("log4j.configuration") returns a
non-null value.  If you get back a non-null value, trust log4j to have
done its own configuration and don't worry about it.  But since you
message conveys a need for configuration success assurance, I'm guessing
you won't like this option.

The 3rd, and IMHO best, option is to make sure the log4j configuration
file is found.  Otherwise, throw various exceptions and don't proceed.
A real-world application cannot and shouldn't proceed without logging

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: wleana [mailto:wleana@yahoo.com]
>Sent: Monday, April 14, 2003 2:49 AM
>To: log4j-user@jakarta.apache.org
>Subject: configure programmatically if properties not found, how to?
>I want to have a duplicate configuration programed into source code
>to cover the situation when the properties file is not found.
>Wondering how to do it since I am not calling
>PropertyConfiguration.configure() explicitly in the code. Then how do
>I know if it succeeds or fails?  So maybe I should make that call
>explicitly? But if I do that, seems that I need to pass in the
>string "log4j.properties" directly to it?  And also, since the
>PropertyConfiguation.configure(String configFileName) returns void,
>how can I know if it has found the file or not?
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

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

View raw message