| Author |
Property file prob in Log4j
|
s. anitha
Greenhorn
Joined: Jan 18, 2005
Posts: 18
|
|
Hai , i m new to the Log4j i m using PropertyConfigurator to get the content of the .property file. how did i get the .Xml file which is a property file.if i specify property in xml file ,how can i read that in java file(like property Configurator) pls help me. Thanks in Advance.
|
 |
Jason Menard
Sheriff
Joined: Nov 09, 2000
Posts: 6450
|
|
"sanitha", Please have another look at the naming policy. JavaRanch requires each registered user to use a plausible first name and last name as their display name, not just a single name, not a first name and a made-up last name, etc... Regarding your questin, this still isn't the correct forum for log4j questions, so I'm going to move this to Other Open Source Projects.
|
Jason's Blog
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1340
|
|
I'm not really sure what you are asking. How did you get the .xml file? If you have a log4j.xml or log4j.properties file in the classpath, log4j will pick it up (see debug output below, it shows log4j looking first for log4j.xml and then log4j.properties. To specify a differently named or located properties file you can use PropertyConfigurator.configure(), passing the file name into that method.
Originally posted by sanitha: Hai , i m new to the Log4j i m using PropertyConfigurator to get the content of the .property file. how did i get the .Xml file which is a property file.if i specify property in xml file ,how can i read that in java file(like property Configurator) pls help me. Thanks in Advance.
Info below from The Complete log4j Manual by Ceki Gulcu Pass in file name to main method: PropertyConfigurator.configure(args[0]); log4j looks for log4j.xml, then log4j.properties on the command line: C:\_tools\log4j-manual-2004-12-12\examples>java -Dlog4j.debug chapter3.MyApp2 chapter3/sample0.properties log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@12f6684. log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@12f6684 class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@12f6684. log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@12f6684 class loader. log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource(). ...
|
 |
 |
|
|
subject: Property file prob in Log4j
|
|
|