<?xml version="1.0" encoding="UTF-8"?>
<!--Log configuration root node-->
<configuration>
<!--Set the context name-->
<contextName>MulunSrb</contextName>
<!-- Log output directory -->
<property name="" value="/Users/mulun/Log/oss/"/>
<!--Console log format: Color log-->
<!-- magenta:Magenta -->
<!-- boldMagenta:Coarse red-->
<!-- cyan:Cyan -->
<!-- white:white -->
<property name="CONSOLE_LOG_PATTERN"
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
<!--File Log Format-->
<property name="FILE_LOG_PATTERN"
value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
<!--Coding-->
<property name="ENCODING"
value="UTF-8"/>
<!-- Console Log -->
<!-- <appender> is a child node of <configuration> and is the component responsible for writing logs-->
<!-- <appender>There are two necessary attributes name and class: name specifies the appender name, class specifies the fully qualified name of the appender -->
<!-- <encoder>Format the log-->
<!-- <pattern>Define the specific output format of the log-->
<!-- <charset>Coding method-->
<appender name="CONSOLE" class="">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- File Log -->
<!-- <file> indicates the location of the log file. If the upper directory does not exist, it will be automatically created and there is no default value. -->
<!-- <append>Default true, the log is appended to the end of the file. If it is false, the existing files will be cleared after the service restarts. -->
<appender name="FILE" class="">
<file>${}/</file>
<append>true</append>
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- Scrolling Log-->
<!-- Problem: In a production environment, if the system runs for a long time, the log files will become larger and larger, and the time for the system to read and write logs will become slower and slower. In severe cases, the system will run out of system memory and cause the system to go down. -->
<!-- Solution: You can set scroll logs -->
<!-- RollingFileAppender is another implementation of Appender, which means scrolling to record files, first record the logs to the specified file, and when a certain condition is met, the old logs are backed up to other files-->
<!-- <rollingPolicy> is a child of <appender> that defines the scrolling policy. -->
<!-- TimeBasedRollingPolicy: The most commonly used scrolling strategy, formulate scrolling strategies based on time. -->
<!-- <fileNamePattern>: Contains the file name and conversion character, "%d" can contain the specified time format, such as: %d{yyyy-MM-dd}. If %d is used directly, the default format is yyyy-MM-dd. -->
<!-- <maxHistory>: Optional node, controlling the maximum number of archive files retained, and deletes old files if the number exceeds it. Assuming that the monthly scrolling is set and <maxHistory> is 6, only files from the last 6 months will be saved and old files from the previous ones will be deleted. Note that deleting old files means that directories created for archives will also be deleted. -->
<appender name="ROLLING_FILE" class="">
<!-- To distinguish it from the file names in other appenders -->
<file>${}/</file>
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>${ENCODING}</charset>
</encoder>
<!-- Set scrolling policy for scrolling logging -->
<rollingPolicy class="">
<!-- Log Archive Path and Format -->
<fileNamePattern>${}/info/log-rolling-%d{yyyy-MM-dd}.%</fileNamePattern>
<!--Maximum number of archive log files retained-->
<maxHistory>15</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<!-- Logger, if the following multi-environment logs are configured, do not enable this -->
<!-- <logger> can be a child node of <configuration>, which is used to set the log printing level of a certain package or a specific class, and specify <appender>-->
<!-- name: used to specify a package or a specific class that is subject to this logger-->
<!-- level: Used to set the print level, case independent: TRACE, DEBUG, INFO, WARN, ERROR, ALL and OFF. The level of the superior is inherited by default->
<!-- <logger> can contain zero or more <appender-ref> elements, identifying this appender will be added to this logger-->
<!-- <logger name="" level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</logger>-->
<!-- Development Environment and Test Environment -->
<springProfile name="dev,test">
<logger name="" level="DEBUG">
<appender-ref ref="CONSOLE"/>
</logger>
</springProfile>
<!-- Production Environment -->
<springProfile name="prod">
<logger name="" level="ERROR">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="ROLLING_FILE"/>
</logger>
</springProfile>
</configuration>