码迷,mamicode.com
首页 > 其他好文 > 详细

log4j的日志

时间:2019-10-26 12:11:29      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:org   imp   alibaba   tar   file   user   logistic   线程   inter   

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="off">
<Properties>
<Property name="ctx">dangbao</Property>
<Property name="dir">d:/app/logs</Property>
<!-- ${sys:java.io.tmpdir} d:/logs 以${logDir}方式引用-->
</Properties>
<CustomLevels>
<CustomLevel name="sysoprate" intLevel="350" />
</CustomLevels>

<Appenders>
<!--控制台输出-->
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<!--回滚文件-->
<RollingFile name="RollingFile" fileName="${dir}/${ctx}/logs/${ctx}.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
<RollingFile name="druidRollingFile" fileName="${dir}/${ctx}/logs/${ctx}_druid.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_druid-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
</RollingFile>
<RollingFile name="shiro_oprate.log" fileName="${dir}/${ctx}/logs/${ctx}_shiro_oprate.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_shiro_oprate-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
<RollingFile name="sys_oprate_file" fileName="${dir}/${ctx}/logs/${ctx}_sys_oprate.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_sys_oprate-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
<RollingFile name="sys_user_oprate_file" fileName="${dir}/${ctx}/logs/${ctx}_sys_user_oprate.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_sys_user_oprate-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
<RollingFile name="druidStatLoggerFile" fileName="${dir}/${ctx}/logs/${ctx}_druidStatLogger.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_druidStatLogger-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
<RollingFile name="logistics_operate_log" fileName="${dir}/${ctx}/logs/${ctx}_logistics_operate_log.log"
filePattern="${dir}/${ctx}/logs/${date:yyyy-MM}/${ctx}_logistics_operate_log-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
</Appenders>


<Loggers>
<!-- Async表示异步写日志,另起线程来写日志 -->
<AsyncRoot level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</AsyncRoot>
<!-- <AsyncLogger name="org.water.common.log" level="sysoprate"> -->
<!-- <AppenderRef ref="sys_oprate_file"/> -->
<!-- </AsyncLogger> -->
<AsyncLogger name="org.apache.shiro" level="info" additivity="false">
<AppenderRef ref="shiro_oprate.log"/>
</AsyncLogger>
<AsyncLogger name="org.water.common.log.BaseLog" level="info" additivity="false">
<AppenderRef ref="sys_oprate_file"/>
</AsyncLogger>
<!-- 系统用户后台操作日志 -->
<AsyncLogger name="user.oprate.log" level="info" additivity="false">
<AppenderRef ref="sys_user_oprate_file"/>
</AsyncLogger>
<!-- 自定义日志输出 -->
<!-- <AsyncLogger name="org.water.common.log.DruidStatLogger" level="info" >
<AppenderRef ref="druidStatLoggerFile"/>
</AsyncLogger> -->
<!-- durid日志输出 -->
<AsyncLogger name="com.alibaba.druid.pool.DruidDataSourceStatLoggerImpl" level="info" additivity="false">
<AppenderRef ref="druidStatLoggerFile"/>
</AsyncLogger>
<!-- sql性能 -->
<!-- <Logger name="druid.sql.Statement" level="debug" includeLocation="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="druidRollingFile"/>
</Logger> -->
<!-- sql执行语句 -->
<AsyncLogger name="druid.sql" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="druidRollingFile"/>
</AsyncLogger>
<!-- 对外接口调用 -->
<AsyncLogger name="logistics.operate.log" level="info">
<AppenderRef ref="logistics_operate_log"/>
</AsyncLogger>
</Loggers>
</Configuration>

log4j的日志

标签:org   imp   alibaba   tar   file   user   logistic   线程   inter   

原文地址:https://www.cnblogs.com/pxzbky/p/11742416.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!