标签:style blog color os 文件 io for div
import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyApp { final static Logger logger = LoggerFactory.getLogger("MyApp.class"); public static void main(String[] args) { logger.trace("trace"); logger.debug("debug"); logger.info("info"); logger.warn("warn"); logger.error("error"); System.out.println(111); } }
<configuration> <property name="LOG_FORMAT" value="%date [%thread] %-5level %logger - %msg%n%rEx" /> <property name="CHARSET" value="UTF-8" /> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">//输出到控制台 <encoder> <pattern>%date [%thread] %-5level (%file:%line\) - %msg%n</pattern>//输出格式 <charset>${CHARSET}</charset> </encoder> </appender> <appender name="file—info" class="ch.qos.logback.core.rolling.RollingFileAppender">//输出到文件 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>D:/logs/info.%d{yyyy-MM-dd}.log</FileNamePattern> <MaxHistory>30</MaxHistory> </rollingPolicy> <encoder> <pattern>%date [%thread] %-5level (%file:%line\) - %msg%n</pattern> <charset>${CHARSET}</charset> </encoder> </appender> <root level="info"> <appender-ref ref="stdout" /> <appender-ref ref="file—info" /> </root> </configuration>
标签:style blog color os 文件 io for div
原文地址:http://www.cnblogs.com/sunfan1988/p/3871742.html