This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have currently been using Log4j. I have all log4j related configuration in the log4j.properties file. I have custom class called Logger which reads from this log4j.properties file doing an I/O operation.
Now we have to change this to using log4j.xml. I need all config properties in log4j.xml & a new java class to read from this properties from log4j.xml.
If anyone has already got a sample example or links where i can find the same please do post it.
I looked through a lot of sites for help but all use log4j.properties rather than log4j.xml.
FYI, The complete log4j manual by Ceki G�lc� is well worth the money it costs; it comes with a bunch of example code and explanations of the examples. I hope it gets updated for the new 1.3 version before my subscription expires :-)
After some struggle, I am finally able to 'log' stuff to a file. I basically took Tim's XML file (Thanks Tim) and modified it to suit my web application. I am currently logging to D:\temp\junk.log.
I named the XML file as log4j.xml and copied it to my WEB-INF/lib and in the WEB-INF/classes directory. So, I am not sure which one is picked up. Its a trial and error process.
I haven't seen good documentation on how to set up the file etc etc untill I read this post. Thanks.
Update: The log4j.xml file needs to be in the classes dir and not in the lib dir. When I put the file in the lib dir only, it did not create a logger and gave me an error message saying - no appender found. So put it in the classes directory.
- m [ July 12, 2005: Message edited by: Madhav Lakkapragada ]