zoukankan      html  css  js  c++  java
  • log4j2配置

    log4j2

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd">
    
    <!--设置log4j2的自身log级别为warn -->
    <configuration status="info">
    
        <appenders>
            <console name="Console" target="SYSTEM_OUT">
                <PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
            </console>
    
            <RollingFile name="RollingFileInfo" fileName="${sys:user.home}/logs/info.log"
                filePattern="${sys:user.home}/logs/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="INFO" />
                    <ThresholdFilter level="WARN" onMatch="DENY"
                        onMismatch="NEUTRAL" />
                </Filters>
                <PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <SizeBasedTriggeringPolicy size="100 MB" />
                </Policies>
            </RollingFile>
    
            <RollingFile name="RollingFileWarn" fileName="${sys:user.home}/logs/warn.log"
                filePattern="${sys:user.home}/logs/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="WARN" />
                    <ThresholdFilter level="ERROR" onMatch="DENY"
                        onMismatch="NEUTRAL" />
                </Filters>
                <PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <SizeBasedTriggeringPolicy size="100 MB" />
                </Policies>
            </RollingFile>
    
            <RollingFile name="RollingFileError" fileName="${sys:user.home}/logs/error.log"
                filePattern="${sys:user.home}/logs/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
                <ThresholdFilter level="ERROR" />
                <PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <SizeBasedTriggeringPolicy size="100 MB" />
                </Policies>
            </RollingFile>
    
        </appenders>
    
        <loggers>
            <!--过滤掉spring和hibernate的一些无用的debug信息 -->
            <!-- <logger name="org.springframework" level="ERROR"> </logger> <logger 
                name="org.hibernate" level="ERROR"> </logger> -->
            <logger name="com.onloon.contact" level="trace" additivity="false">
                <appender-ref ref="Console" />
            </logger>
            <logger name="org.springframework" level="info" additivity="false">
                <appender-ref ref="Console" />
            </logger>
            <root level="error">
                <appender-ref ref="Console" />
                <appender-ref ref="RollingFileInfo" />
                <appender-ref ref="RollingFileWarn" />
                <appender-ref ref="RollingFileError" />
            </root>
        </loggers>
    
    </configuration>
  • 相关阅读:
    K8S--架构及基本概念
    虚拟化及云原生的一些概念
    JPA事务中的异常最后不也抛出了,为什么没被catch到而导致回滚?
    OpenFaaS实战之六:of-watchdog(为性能而生)
    OpenFaaS实战之五:大话watchdog
    OpenFaaS实战之四:模板操作(template)
    OpenFaaS实战之三:Java函数
    OpenFaaS实战之二:函数入门
    OpenFaaS实战之一:部署
    Python
  • 原文地址:https://www.cnblogs.com/wanhua-wu/p/9334398.html
Copyright © 2011-2022 走看看