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>
  • 相关阅读:
    百度富文本编辑器的上传图片的路径问题
    laravel初次学习总结及一些细节
    macOS apache配置及开启虚拟服务器的开启,apache开启重写模式
    类似于qq空间类型的评论和回复
    向php提交数据及json
    mac 初次配置apache,及mac下安装mysql
    C#连接mysql数据库插入数据后获取自增长主键ID值
    PHP 真正多线程的使用
    C# 连接mysql数据库
    MySql状态查看方法 MySql如何查看连接数和状态?
  • 原文地址:https://www.cnblogs.com/wk-missQ1/p/14292956.html
Copyright © 2011-2022 走看看