Play Framework 2.2 log output to console in tests

前端 未结 2 1184
情书的邮戳
情书的邮戳 2021-02-13 07:08

How do I configure the logger in Play Framework 2.2 in order that I see log output in the console during play integration tests?

The configuration for Play Framework 2.1

2条回答
  •  迷失自我
    2021-02-13 07:51

    Update To understand more about how logback is configured you should pass -Dlogback.debug=true property to the jvm/play. This might save you hours of debbugging.

    Add a file in test/logback-test.xml (needs to be on classpath so it might depend on how the play application is configured to find tests resources) with a content like

    
    
        
    
        
            ${application.home:-.}/logs/application.log
            
                %date - [%level] - from %logger in %thread
                    %n%message%n%xException%n
            
        
    
        
            
                %coloredLevel %logger{15} - %message%n%xException{5}
            
        
    
        
        
    
        
            
            
        
    
    
    

提交回复
热议问题