This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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)
Pass in file name to main method: PropertyConfigurator.configure(args);
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(). ...