logback.xml

开发环境

 

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
  <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> 
    <layout class="ch.qos.logback.classic.PatternLayout"> 
      <pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} - %msg%n</pattern> 
    </layout> 
  </appender> 
 
  <logger name="java.sql.PreparedStatement" level="DEBUG" /> 
  <logger name="org.springframework.ui.freemarker" level="DEBUG" /> 
 
  <root level="INFO"> 
    <appender-ref ref="stdout" /> 
  </root> 
</configuration> 
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} - %msg%n</pattern>
    </layout>
  </appender>

  <logger name="java.sql.PreparedStatement" level="DEBUG" />
  <logger name="org.springframework.ui.freemarker" level="DEBUG" />

  <root level="INFO">
    <appender-ref ref="stdout" />
  </root>
</configuration>

 

生产环境

 

 <?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
  <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>logs/xxx.log</file> 
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
      <fileNamePattern>logs/xxx.%d{yyyy-MM-dd}.log.zip</fileNamePattern> 
    </rollingPolicy> 
    <layout class="ch.qos.logback.classic.PatternLayout"> 
      <pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} - %msg%n</pattern> 
    </layout> 
  </appender> 
 
  <root level="WARN"> 
    <appender-ref ref="file" /> 
  </root> 
</configuration> 

你可能感兴趣的:(thread,sql,freemarker,xml,UI)