Example
Properties properties = new Properties();
properties.put("log4j.logger.test","DEBUG,test");
properties.put("log4j.appender.test","org.apache.log4j.DailyRollingFileAppender");
properties.put("log4j.appender.test.DatePattern","'.'yyyy_MM_dd");
properties.put("log4j.appender.test.File","C:/TEMP/a.log");
properties.put("log4j.appender.test.layout","org.apache.log4j.PatternLayout");
properties.put("log4j.appender.test.layout.ConversionPattern","[Test] [%d{dd/MM/yyyy HH:mm:ss,SSS}] (%c:%L) - %5p - %m%n");
PropertyConfigurator.configure(properties);
Properties properties = new Properties();
properties.put("log4j.logger.test","DEBUG,test");
properties.put("log4j.appender.test","org.apache.log4j.DailyRollingFileAppender");
properties.put("log4j.appender.test.DatePattern","'.'yyyy_MM_dd");
properties.put("log4j.appender.test.File","C:/TEMP/a.log");
properties.put("log4j.appender.test.layout","org.apache.log4j.PatternLayout");
properties.put("log4j.appender.test.layout.ConversionPattern","[Test] [%d{dd/MM/yyyy HH:mm:ss,SSS}] (%c:%L) - %5p - %m%n");
PropertyConfigurator.configure(properties);
0 comments:
แสดงความคิดเห็น