0% found this document useful (0 votes)
4 views

Config Logger Spring (Logback-spring.xml)

This document is a configuration file for logging in a Java application using Logback. It specifies the log file path, console output format, and a rolling file appender that archives logs daily or when they exceed 100MB. The root logger is set to 'info' level and references both the console and rolling file appenders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Config Logger Spring (Logback-spring.xml)

This document is a configuration file for logging in a Java application using Logback. It specifies the log file path, console output format, and a rolling file appender that archives logs daily or when they exceed 100MB. The root logger is set to 'info' level and references both the console and rolling file appenders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

<?xml version="1.0" encoding="UTF-8"?

>

<configuration> # Path write log


<property name="LOGS" value="D:\Desktop\log"/>

# Declare config to export console


<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm} %-5level ${PID:-} %logger{40} : %msg %n
</Pattern>
</layout>
</appender>

<appender name="RollingFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS}/dev.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd HH:mm} %-5level ${PID:-} %logger{40} : %msg
%n</Pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>${LOGS}/archived/spring-boot-logger-%d{yyyy-MM-dd}.
%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

<root level="info">
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</configuration>

You might also like