zoukankan      html  css  js  c++  java
  • log4j日志文件模板

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
        status : 这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,会看到log4j2内部各种详细输出
        monitorInterval : Log4j能够自动检测修改配置文件和重新配置本身, 设置间隔秒数。
    -->
    <Configuration status="INFO" monitorInterval="30">
        <Properties>
            <Property name="log-path">/home/logs/smart-admin/dev/logs</Property>
        </Properties>
        <Appenders>
            <Console name="Console" target="SYSTEM_OUT">
                <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
                <PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
            </Console>
            <RollingFile name="debug" fileName="${log-path}/debug/smart-admin_debug.log"
                         filePattern="${log-path}/debug/smart-admin_debug_%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
                </Filters>
                <PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                    <SizeBasedTriggeringPolicy size="50 MB"/>
                </Policies>
                <DefaultRolloverStrategy max="30">
                    <Delete basePath="${log-path}/debug" maxDepth="1">
                        <IfFileName glob="smart-admin_debug_*.log"/>
                        <IfLastModified age="15d"/>
                    </Delete>
                </DefaultRolloverStrategy>
            </RollingFile>
            <RollingFile name="info" fileName="${log-path}/info/smart-admin_info.log"
                         filePattern="${log-path}/info/smart-admin_info_%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
                </Filters>
                <PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                    <SizeBasedTriggeringPolicy size="50 MB"/>
                </Policies>
                <DefaultRolloverStrategy max="30">
                    <Delete basePath="${log-path}/info" maxDepth="1">
                        <IfFileName glob="smart-admin_info_*.log"/>
                        <IfLastModified age="15d"/>
                    </Delete>
                </DefaultRolloverStrategy>
            </RollingFile>
            <RollingFile name="warn" fileName="${log-path}/warn/smart-admin_warn.log"
                         filePattern="${log-path}/warn/smart-admin_warn_%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
                </Filters>
                <PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                    <SizeBasedTriggeringPolicy size="50 MB"/>
                </Policies>
                <DefaultRolloverStrategy max="30">
                    <Delete basePath="${log-path}/warn" maxDepth="1">
                        <IfFileName glob="smart-admin_warn_*.log"/>
                        <IfLastModified age="15d"/>
                    </Delete>
                </DefaultRolloverStrategy>
            </RollingFile>
            <RollingFile name="error" fileName="${log-path}/error/smart-admin_error.log"
                         filePattern="${log-path}/error/smart-admin_error_%d{yyyy-MM-dd}-%i.log">
                <Filters>
                    <ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
                </Filters>
                <PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                    <SizeBasedTriggeringPolicy size="10 MB"/>
                </Policies>
                <DefaultRolloverStrategy max="30">
                    <Delete basePath="${log-path}/error" maxDepth="1">
                        <IfFileName glob="smart-admin_error_*.log"/>
                        <IfLastModified age="15d"/>
                    </Delete>
                </DefaultRolloverStrategy>
            </RollingFile>
        </Appenders>
        <Loggers>
            <Root level="info">
                <AppenderRef ref="Console"/>
                <AppenderRef ref="debug"/>
                <AppenderRef ref="info"/>
                <AppenderRef ref="warn"/>
                <AppenderRef ref="error"/>
            </Root>
        </Loggers>
    </Configuration>
  • 相关阅读:
    HDu 2830 Matrix Swapping II(dp)
    服务器http处理流程
    iOS网络缓存机制
    软件设计需要的两项能力:理解与抽象
    编程思想的本质
    编程思想:面向对象与面向过程
    You Can Customize Synthesized Instance Variable Names @property
    nil / Nil / NULL / NSNull VS objc_msgSend
    对OC中property的一点理解
    @property 的本质是什么?
  • 原文地址:https://www.cnblogs.com/wk-missQ1/p/14292956.html
Copyright © 2011-2022 走看看