1
resposta

Logback log pattern

Boa tarde,

copiei o padrão que estava na documentação do sleuth, mas a saida nos logs do papertrails não mostram o traceId

segue o pattern que eu consegui:

<suffixPattern>
%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
</suffixPattern>

o que há de errado nele?

1 resposta

Olá Leonardo. Verifique se há alguma diferença com esse conteúdo abaixo:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <appender name="PAPERTRAIL"
        class="ch.qos.logback.classic.net.SyslogAppender">
        <syslogHost>logs.papertrailapp.com</syslogHost>
        <port>12246</port>
        <facility>USER</facility>
        <suffixPattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</suffixPattern>
    </appender>

    <appender name="STDOUT"
        class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} -
                %msg%n
            </pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="STDOUT" />
        <appender-ref ref="PAPERTRAIL" />
    </root>
</configuration>