logback xml配置按天生成
原创    iwantyou    发表于:2019-04-11 14:59:08
  阅读 :83   收藏   编辑
<configuration  scan="true" scanPeriod="60 seconds" debug="false" >

   <property name="LOG_HOME" value="/home/sp_man/logs/site" />  
   <contextName>scpSale-Server</contextName>  
   <!-- 控制点输出 -->
   <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
       <encoder>
           <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
       </encoder>
   </appender>
   <!-- 按照每天生成日志文件 -->   
   <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">   
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">   
              <fileNamePattern>${LOG_HOME}/info.%d{yyyy-MM-dd}</fileNamePattern>   
              <maxHistory>30</maxHistory>    
        </rollingPolicy>   
        <encoder>
              <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>   
        </encoder>   
    </appender>
   <root level="INFO">
       <appender-ref ref="console" />
       <appender-ref ref="file" />
  </root>
</configuration>


评论
条评论