SpringBoot日志分割

创建logback.xml:

resources路径下创建该文件,并复制如下代码。





    
    
    
    
    
    
    

    
    
    
    

    
    
    
    
    
    
    
    

    
    
        
            ${log.pattern}
        
    

    
    
        ${log.path}/${log.name}.log
        
            ${log.level}
        
        
            
            ${log.path}/${log.name}.%d{${log.timeFormat}}-%i.log
            ${log.maxHistory}
            
                ${log.maxFileSize}
            
        
        
            ${log.pattern}
        
    

    
    
        ${log.path}/error/${log.name}_error.log
        
            ERROR
        
        
            ${log.path}/error/${log.name}_error.%d{${log.timeFormat}}.%i.log
            ${log.maxHistory}
            
                ${log.maxFileSize}
            
        
        
            ${log.pattern}
        
    

    
    
        
        
        
    

添加配置application.properties:

log.path=/data/log/
log.level=info
log.name=cetc-meeting

你可能感兴趣的:(spring,boot)