log4j.properties ### 设置Logger输出级别和输出目的地 ### log4j.rootLogger=debug,stdout,logfile ### 把日志信息输出到控制台 ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.err log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout ### 把日志信息输出到文件:jbit.log ### log4j.appender.logfile=org.apache.log4j.FileAppender log4j.appender.logfile.File=jbit.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %p %F %M %m %n
private static Logger logger = Logger.getLogger(Test.class); public static void main(String[] args) { logger.debug("222"); }
时间: 2025-01-01 02:59:29