logback on a mac returns question marks instead of words

后端 未结 2 1598
闹比i
闹比i 2021-02-09 02:23

I\'m just start using logback for logging my Java project running on glassfish3 AS, and I\'m noticing some strange thing. This string of code

LOG.error(\"Вычисле         


        
2条回答
  •  余生分开走
    2021-02-09 03:03

    Try to define charset for encoder:

    
        ../logs/logback.log
        
            utf-8
            %d{HH:mm:ss.SSS} %-5level %logger{35} - %msg%n
        
    
    

    Sadly it's not described in documentation, but you can always lookup properties in source code. Specyfing instantize PatternLayoutEncoder. Going up to its parent LayoutWrappingEncoder you can find method setCharset(). When specified it is used, as you can see in http://logback.qos.ch/xref/ch/qos/logback/core/encoder/LayoutWrappingEncoder.html#120

提交回复
热议问题