简单配置: ### ??Logger?????????? ### ##log4j.rootLogger=debug, stdout,logfile log4j.rootLogger=debug, stdout ### ??????????? ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.err log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout ### ???????????zs.log ### # log4j.appender.logfile=org.apache.log4j.FileAppender # log4j.appender.logfile.File=zs.log # log4j.appender.logfile.layout=org.apache.log4j.PatternLayout # log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}%l %F %p %m%n
简单使用:
public Logger log=JDBC.logger; String sql="insert into student values ("+s.getId()+",'"+s.getName()+"',"+s.getAge()+",'"+s.getEmail()+"','"+s.getBirth()+"');"; try { log.info(sql);