Thread: log4j
View Single Post
  #4 (permalink)  
Old 01-18-2008, 08:49 PM
roots's Avatar
roots roots is offline
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 258
roots is on a distinguished road
You have some space problem in the code such as space before Appender in second line and space in ISO86 01

Make sure the file for log is accessible, i used a.txt for testing.


This is the fixed code,
Code:
log4j.rootLogger=debug,D log4j.appender.D=org.apache.log4j.DailyRollingFileAppender log4j.appender.D.DatePattern='.'yyyy-MM-dd-HH-mm log4j.appender.D.File=C:/a.txt log4j.appender.D.layout=org.apache.log4j.PatternLayout log4j.appender.D.layout.ConversionPattern=%d{ISO8601} %-5p [%c] - %m%n log4j.appender.D.Append =true
Sample Java code for the test
Code:
PropertyConfigurator.configure("config.properties"); Logger logger = Logger.getLogger(Main.class); while(true){ // Leaved for 5 minutes to see it happen logger.info("SOME LOG MESSAGE"); Thread.sleep(5000); }
Output

http://www.java-forums.org/attachmen...1&d=1200681977
Attached Images
File Type: jpg ScreenShot028.jpg (51.5 KB, 3 views)
__________________
dont worry newbie, we got you covered.
Reply With Quote