Play Framework 2.2 log output to console in tests

前端 未结 2 908
庸人自扰
庸人自扰 2021-02-13 07:10

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 08:12

    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}
            
        
    
        
        
    
        
            
            
        
    
    
    

提交回复
热议问题