log4j properties file: how to configure ?

Posted by EugeneP on Stack Overflow See other posts from Stack Overflow or by EugeneP
Published on 2010-03-26T09:24:39Z Indexed on 2010/03/26 9:33 UTC
Read the original article Hit count: 365

Filed under:
|
|

Is it right that the procedure of using log4j looks like this:

1) put a .properties file somewhere in a project folder

2) in an initialization method, that runs only once, invoke

PropertyConfigurator.configure("path_to_file");

3) in every method we need to use logger we define a static logger variable and simply invoke getLogger(class)

I'm asking you this: what if the initialization module is not defined?

Where to put "log4j.properties" file so that we wouldn't need to invoke propertyconfigurator.configure at all, or if it's not possible,

is it ok to invoke PropertyConfigurator.configure("path_to_file") in every method that uses a logger?

© Stack Overflow or respective owner

Related posts about java

Related posts about log4j