[JAVA] [Note] Configuration file when using Logback with Spring Boot

As a reminder, the configuration file when using Logback in Spring Boot is listed below.

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

    <!--Use the default standard output-->
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />

    <!--Change the output pattern of standard output from the default-->
    <property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %t [%-5p] [%c] %m%n"/>

    <!--I want to separate the file output by INFO and ERROR, so define them separately.-->
    <!--Definition for INFO level output-->
    <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<encoder>
            <charset>UTF-8</charset>
			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
		</encoder>
		<file>Log file name</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
			<fileNamePattern>Log file name.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
			<maxFileSize>10MB</maxFileSize>
		</rollingPolicy>
	</appender>

    <!--Definition for ERROR level output-->
    <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!--Define a filter to output only the ERROR level-->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
          <level>ERROR</level>
          <onMatch>ACCEPT</onMatch>
          <onMismatch>DENY</onMismatch>
        </filter>
		<encoder>
            <charset>UTF-8</charset>
			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
		</encoder>
		<file>Error log file name</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
			<fileNamePattern>Error log file name.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
			<maxFileSize>10MB</maxFileSize>
		</rollingPolicy>
	</appender>

    <!--Output INFO level or higher-->
    <root level="INFO">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE_INFO" />
        <appender-ref ref="FILE_ERROR" />
    </root>
</configuration>

Recommended Posts

[Note] Configuration file when using Logback with Spring Boot
File upload with Spring Boot
Try using Spring Boot with VS Code
Asynchronous processing with Spring Boot using @Async
Download with Spring Boot
Try using DI container with Laravel and Spring Boot
Try using OpenID Connect with Keycloak (Spring Boot application)
[JUnit 5 compatible] Write a test using JUnit 5 with Spring boot 2.2, 2.3
A memorandum when creating a REST service with Spring Boot
File upload with Spring Boot (do not use Multipart File)
Error handling when the maximum file size is exceeded when uploading a file with Spring Boot
Generate barcode with Spring Boot
Hello World with Spring Boot
Implement GraphQL with Spring Boot
Get started with Spring boot
Hello World with Spring Boot!
Run LIFF with Spring Boot
SNS login with Spring Boot
Spring Boot starting with copy
Using Mapper with Java (Spring)
Spring Boot starting with Docker
Hello World with Spring Boot
Set cookies with Spring Boot
Use Spring JDBC with Spring Boot
Add module with Spring Boot
Getting Started with Spring Boot
Try using Spring Boot Security
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
Create microservices with Spring Boot
Send email with spring boot
Extract SQL to property file with jdbcTemplate of spring boot
Overwrite bean definition in spring xml configuration file with another xml
I tried to get started with Swagger using Spring Boot
Use Basic Authentication with Spring Boot
Memorandum of understanding when Spring Boot 1.5.10 → Spring Boot 2.0.0
gRPC on Spring Boot with grpc-spring-boot-starter
Set Spring profile when executing bootRun task with Spring Boot Gradle Plugin
Create an app with Spring Boot 2
Hot deploy with Spring Boot development
Database linkage with doma2 (Spring boot)
Spring Boot Tutorial Using Spring Security Authentication
Spring Boot programming with VS Code
Until "Hello World" with Spring Boot
Inquiry application creation with Spring Boot
Part 1: Try using OAuth 2.0 Login supported by Spring Security 5 with Spring Boot
Fitted in Spring Boot using a bean definition file named application.xml
Get validation results with Spring Boot
Things to note when using Spring AOP in Jersery resource classes
Implement file download with Spring MVC
(Intellij) Hello World with Spring Boot
Create an app with Spring Boot
Google Cloud Platform with Spring Boot 2.0.0
Check date correlation with Spring Boot
I tried GraphQL with Spring Boot
[Java] LINE integration with Spring Boot
Image Spring Boot app using jib-maven-plugin and start it with Docker
Beginning with Spring Boot 0. Use Spring CLI
I tried Flyway with Spring Boot
Unknown error in line 1 of pom.xml when using Spring Boot in Eclipse
Message cooperation started with Spring Boot
Spring Boot gradle build with Docker