欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spring-Boot Log4j配置文件

程序员文章站 2022-04-19 22:40:12
...
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>
        <Property name="logPath">/opt/logs/accounting</Property>
    </Properties>
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <RollingFile name="FILE" fileName="${logPath}/accounting.log" filePattern="${logPath}/accounting-%d{yyyy-MM-dd-HH}.log">
            <PatternLayout pattern="%date %5level [%thread] (%file:%line) - %m%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
            </Policies>
        </RollingFile>
    </Appenders>
    <Loggers>
        <logger name="com.ftvalue.accounting" level="info" />
        <Root level="INFO">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="FILE"/>
        </Root>
    </Loggers>
</Configuration>