|
I am new to Log4J and chainsaw, and there is something I can't make work. I managed to make my logger use the console appender, the log file appender, and the xml appender. I can visualize my XML file with chainsaw, but I would like to use a LogFilePatternReceiver, so I won't have to open my file every time it changes. (If I get this right) To do that I create a new LogFilePatternReceiver, and I fill the form as follows: fileURL : file:/foo/bar/exemple5.log //<-- created with a FileAppender filterExpression : LEVEL >= INFO logFormat : %d %-5p %c - %F:%-4L - %m%n // <-- cut'n pasted from the properties file, the pattern I used for the FileAppender name : whatever tailing : true timestampFormat : by default and chainsaw seems to find my files because the messages I get from it are like >>found non-matching line: 2005-02-02 11:48:59,453 WARN org.progx - exemple5.java: 19 - Exiting application where the non matching line belongs to myFile.log. I don't understand this message : does this mean that he can't parse my log file according to the Pattern I gave? In this case there would be a problem, because the Pattern is the same I used to write my log file (I cut'n pasted it from the properties file). (Ah, I forgot to tell that I also gave my properties file to chainsaw when I launched it) Anybody can help me? (is it supposed to look as if I opened my xml file from the File menu, as I expect? ) Thanks. (I attached my files ) |
import org.apache.log4j.*; /* Created on Feb 2, 2005 */
/** @author 20001859 */
public class exemple5 {
static Logger log = Logger.getLogger("org");
public exemple5() {
//log = Logger.getLogger(this.getClass());
log.info("hi there");
}
public static void main(String[] args) {
PropertyConfigurator.configure("exemple5.properties");
log.warn("Starting application");
exemple5 e5 = new exemple5();
log.warn("Exiting application");
}
}
2005-25-02 14:25:09,187 WARN org - exemple5.java:17 - Starting application 2005-25-02 14:25:09,218 INFO org - exemple5.java:11 - hi there 2005-25-02 14:25:09,218 WARN org - exemple5.java:19 - Exiting application
log4j.rootLogger=DEBUG,stdout, logFile, XMLFile log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %F:%-4L - %m%n log4j.appender.logFile=org.apache.log4j.FileAppender log4j.appender.logFile.File=exemple5.log log4j.appender.logFile.layout=org.apache.log4j.PatternLayout log4j.appender.logFile.layout.ConversionPattern=%d %-5p %c - %F:%-4L - %m%n log4j.appender.XMLFile=org.apache.log4j.FileAppender log4j.appender.XMLFile.File=exemple5.xml log4j.appender.XMLFile.layout=org.apache.log4j.xml.XMLLayout log4j.appender.XMLFile.layout.locationInfo=true
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
