Rolling logback logs on filesize and time

后端 未结 3 2181
无人及你
无人及你 2020-11-29 00:04

I\'ve been trying to set up a simple logback project to roll my log files by date and by filesize, and so far I have been unable to get my appender to roll over to another f

3条回答
  •  情深已故
    2020-11-29 01:00

    Since logback 1.1.7 (released March 2016) a new appender called SizeAndTimeBasedRollingPolicy is available that dramatically simplifies what you need to do:

    
        app.log
        
            app-%d{yyyy-MM-dd}.%i.log
            10MB    
            30
            1GB
        
        
            %msg%n
        
    
    

    See here for further info.

提交回复
热议问题