Are there any example log4j configuration files (XML).
I have a java main application.
I want log4j to output to console AND write to file.
Any examples of this would be greatly appreciated.
I'm using netbeans if that matters.
Are there any example log4j configuration files (XML).
I have a java main application.
I want log4j to output to console AND write to file.
Any examples of this would be greatly appreciated.
I'm using netbeans if that matters.
Here is one sample example of log4j.xml used in Hibernate project.Just need to place this file in classpath and you will get log messages on console as well as in file also.If you want any specific appender you can change in tag.
I found this one more descriptive then above one.Hope it help.
The typical thing to do is to put a log4j.properties file in your classpath. The log4j doc will tell you all you need to know about having two appenders for the console and a file, it's in their examples. In other words, don't bother with the less common XML format and stick with the very common properties format.
Just have more than one appender in your log4j.xml, like this: