Hi,
I am new to log4j and trying to use it for a project I am currently
working on. The problem is I would like to specify the location of the
log4j.properties file:
PropertyConfigurator.configure("/path/to/log4j.properties");
But if the file is not found, I would like to use the Basic
configuration:
BasicConfigurator.configure();
I figured I could catch the FileNotFoundException and call the basic
configurator:
try{
PropertyConfigurator.configure("/path/to/log4j.properties");
} catch (FileNotFoundException e) {
BasicConfigurator.configure();
}
But I discovered that the PropertyConfigurator.configure does not throw
a FileNotFoundException, it handles the exception and throws the error
to the console. Is there another way to do this? I have searched the
archive and the internet and could not find an answer, maybe I am not
putting in the proper search terms because it seems like there should be
an easy way to default to a Basic configuration if the properties file
is not present.
Thanks for any help you can provide.
Jon Hoffman