Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Criar o arquivo logback.xml em um diretório. O arquivo deve ter a seguinte estrutura: 

logback.xml

<configuration debug="true" scan="true" scanPeriod="30 seconds">

    <appender name="CONSOLE_LOG" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d %p %c{1.} [%t] %m%n</pattern>
        </encoder>
    </appender>

    <appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">

        <!--  log file directory -->
        <file>logs/tfs-pixmsg-service.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

            <!-- zipped log file directory -->
            <fileNamePattern>logs/tfs-pixmsg-service-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
            <!-- each archived file, size max 10MB -->
            <maxFileSize>4KB</maxFileSize>
            <!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
            <totalSizeCap>20GB</totalSizeCap>
            <!-- 60 days to keep     -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>

        <encoder>
            <pattern>%d %p %c{1.} [%t] %m%n</pattern>
        </encoder>
    </appender>

    <logger name="ch.qos.logback" level="debug" additivity="false"/>


    <root level="debug">
        <appender-ref ref="FILE-ROLLING"/>
        <appender-ref ref="CONSOLE_LOG" />
    </root>

</configuration>

...

Os níveis de log podem ser alterados a partir do application.properties, através das propriedades logging.level

Application.properties

server.tomcat.threads.min-spare=10
server.tomcat.max-threads=50
totvs.conf.path=file:/opt/totvs/tfs/totvs-financial-services.conf
logging.pattern.file=%d{dd/MM/yyyy HH:mm:ss.SSS} | %-5p | ${PID:- } | [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
logging.level.org.springframework=ERROR
logging.level.org.apache.catalina=ERROR
logging.level.org.apache.kafka=ERROR
logging.file.max-history=10
logging.file.max-size=20MB
logging.file.total-size-cap=50MB

logging.level.root=INFO
logging.level.org.springframework.http=ERROR
logging.level.org.springframework.web=ERROR
logging.level.org.springframework.ws.client.MessageTracing=ERROR
logging.level.org.springframework.ws.client.MessageTracing.sent=ERROR
logging.level.org.springframework.ws.server.MessageTracing.sent=ERROR
logging.level.org.springframework.ws.client.MessageTracing.received=ERROR
logging.level.org.springframework.ws.server.MessageTracing.received=ERROR
logging.level.org.hibernate.SQL=ERROR
logging.level.org.hibernate.TYPE=ERROR
logging.level.com.totvs.tfs.integracao.pix.msg=DEBUG
logging.level.java.net.URL=ERROR

#spring.profiles.active=prod

#server.port=40008