Run Logback in Debug

前端 未结 5 1143
不思量自难忘°
不思量自难忘° 2020-12-16 09:13

I\'ve recently switched from log4j to logback and am wondering if there is an easy way to run logback in debug mode, similar to log4j\'s log4j.debug property. I

5条回答
  •  猫巷女王i
    2020-12-16 09:40

    I could not make it work using the chosen answer. However, the following worked:

    java -Dlogback.configurationFile=/path/to/config-debug.xml com.domain.Main
    

    Just add a file (config-debug.xml in this example) somewhere on your server and leave it there when you need to debug. Like the following.

    
        
            
            
                %d{dd-MMM-yyyy HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n
            
        
    
        
            
        
    
    

    Run your application using the afore mentioned -D parameter.

    When things are back to normal, remove the -D parameter and restart your application.

    Source: Chapter 3: Logback configuration

提交回复
热议问题