Hi,
I have seen many questions about the above topics but none that address this. I am trying to use log4j to log to a custom file in $CATALINA_BASE/logs/ directory. I configured the log4j.xml file and copied it into the $CATALINA_BASE/lib/ directory.
I use the following lines to create the logger -
PatternLayout layout = new PatternLayout(); FileAppender appender= new FileAppender("filename.txt");
This is where my problem is. How do I make the FileAppender take the file name I configured in the log4j.xml?
I was hoping it will automatically pick that up, but there is no consructor for FileAppender that will not take a filename.
Do I have to read the log4j.xml to get the name of the file? If so why in the world do I need to set that property in the xml at all?
Any help would be greatly appreciated.
Thanks, - Vas