代码模板
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Specify the refresh internal in seconds. -->
<Configuration monitorInterval="60">
<Properties>
<!-- 配置日志文件输出目录,此配置将日志输出到tomcat根目录下的指定文件夹 -->
<Property name="LOG_HOME">${sys:catalina.home}/casLogs</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%c] - <%m>%n"/>
</Console>
<RollingFile name="file" fileName="${LOG_HOME}/cas.log" append="true"
filePattern="${LOG_HOME}/cas/cas-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
<RollingFile name="auditlogfile" fileName="${LOG_HOME}/cas_audit.log" append="true"
filePattern="${LOG_HOME}/auditlogfile/cas_audit-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
<RollingFile name="perfFileAppender" fileName="${LOG_HOME}/perfStats.log" append="true"
filePattern="${LOG_HOME}/perfFileAppender/perfStats-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%m%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<AsyncLogger name="org.jasig" level="info" additivity="false" includeLocation="true">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncLogger name="org.springframework" level="warn" />
<AsyncLogger name="org.springframework.webflow" level="warn" />
<AsyncLogger name="org.springframework.web" level="warn" />
<AsyncLogger name="org.pac4j" level="warn" />
<!--
<AsyncLogger name="org.opensaml" level="debug" additivity="false">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncLogger name="org.ldaptive" level="debug" additivity="false">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncLogger name="com.hazelcast" level="debug" additivity="false">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</AsyncLogger>
-->
<AsyncLogger name="org.apereo.cas.security" level="warn" additivity="false" includeLocation="true">
<AppenderRef ref="console"/>
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
<AppenderRef ref="perfFileAppender"/>
</AsyncLogger>
<AsyncLogger name="org.jasig.cas.web.flow" level="info" additivity="true" includeLocation="true">
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncLogger name="org.jasig.inspektr.audit.support" level="info" includeLocation="true">
<AppenderRef ref="auditlogfile"/>
<AppenderRef ref="file"/>
</AsyncLogger>
<AsyncRoot level="error">
<AppenderRef ref="console"/>
</AsyncRoot>
</Loggers>
</Configuration>
说明
- 主要是增加了日志文件输出目录${LOG_HOME}参数,然后将各日志文件的输出地址配置到该参数下
网友评论