[logback-user] How to use UTF-8?

moxol moxbetex at gmail.com
Fri May 6 00:04:53 CEST 2011


Thanks, that works for FileAppender.

I tried the same for HTMLLayout but it doesn't works.

This is what I tried.

<appender name="HTML"
class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>logs/logbackFile.html</file> 
    <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
      <fileNamePattern>logs/logbackFile.%d{yyyy-MM-dd}.log</fileNamePattern> 
    </rollingPolicy>
    	
    <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
	<charset>UTF-8</charset>
    	   <layout class="ch.qos.logback.classic.html.HTMLLayout">
                    <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level
%logger{36}%X{ClientID}%msg%n</pattern>
                 </layout>
    	</encoder>
</appender> 


Ceki Gulcu wrote:
> 
> Hello,
> 
> You can set the char encoding with the help of the "charset" property of 
> the encoder referenced by your appender. Example:
> 
> <appender name="FILE" class="ch.qos.logback.core.FileAppender">
>    <file>testFile.log</file>
>    <append>true</append>
> 
>    <encoder>
>      <charset>UTF-8</charset>
>      <pattern>%-4r [%t] %-5level %logger{35} - %msg%n</pattern>
>    </encoder>
> </appender>
> 
> HTH,
> 
> -- 
> QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
> is looking to hire talented software developers. For further details, 
> see http://logback.qos.ch/job.html
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-use-UTF-8--tp31551911p31554549.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list