Logback on Jboss duplicates prefixes and new lines when logging

前端 未结 1 734
忘了有多久
忘了有多久 2020-12-17 01:27

I\'m working on java web project. I use Wildfly 10. I want to use it with logback. I did some configuration:

pom.xml


    

        
1条回答
  •  独厮守ぢ
    2020-12-17 02:03

    WildFly wraps both System.out and System.err in a logger. If you want to use an appender or handler that writes to either stream you need to either use the java.io.FileDescriptor.out (or err) or you need to create a logger category for stdout or stderr as well as a new console-handler to assign to the logger.

    /subsystem=logging/pattern-formatter=stdout:add(pattern="%s%n")
    /subsystem=logging/console-handler=stdout:add(autoflush=true, target=System.out, named-formatter=stdout, level=ALL)
    /subsystem=logging/logger=stdout:add(use-parent-handlers=false, handlers=[stdout], level=ALL)
    

    The above CLI script should remove the default pattern from the logger stdout.

    The corresponding representation in standalone.xml looks like this:

    
      
      
        
      
    
    
      
      
        
      
    
    

    0 讨论(0)
提交回复
热议问题