<?xml version="1.0" encoding="UTF-8" ?>
<!-- Specify the refresh internal in seconds. -->
<Configuration monitorInterval="42">

    <Properties>
        <Property name="log.level">DEBUG</Property>
        <Property name="log.dir">.logs</Property>
        <Property name="pattern">%-d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t][%c{1.}] %m%n</Property>
    </Properties>

    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%highlight{%-d{yyyy-MM-dd HH:mm:ss,SSS}}{FATAL=magenta, ERROR=magenta, WARN=magenta, INFO=magenta, DEBUG=magenta, TRACE=magenta} %highlight{%-5p}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=black, DEBUG=green bold, TRACE=blue} [%t][%highlight{%c{1.}}{FATAL=cyan, ERROR=cyan, WARN=cyan, INFO=cyan, DEBUG=cyan, TRACE=cyan}] %m%n"/>
        </Console>

        <RollingFile name="appLogFile"
                     fileName="${log.dir}/app.log"
                     filePattern="${log.dir}/$${date:yyyy-MM}/app-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout pattern="${pattern}" />
            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="16 MB" />
            </Policies>
            <DefaultRolloverStrategy max="32" />
        </RollingFile>

        <RollingFile name="errorLogFile"
                     fileName="${log.dir}/error.log"
                     filePattern="${log.dir}/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout pattern="${pattern}" />
            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="16 MB" />
            </Policies>
            <DefaultRolloverStrategy max="32" />
        </RollingFile>

        <RollingFile name="casLogFile"
                     append="true"
                     fileName="${log.dir}/cas.log"
                     filePattern="${log.dir}/$${date:yyyy-MM}/cas-%d{yyyy-MM-dd}-%i.log">

            <PatternLayout pattern="${pattern}" />
            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="16 MB" />
            </Policies>
            <DefaultRolloverStrategy max="64" />
        </RollingFile>

        <RollingFile name="auditLogFile"
                     append="true"
                     fileName="${log.dir}/audit.log"
                     filePattern="${log.dir}/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout pattern="${pattern}" />
            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="16 MB" />
            </Policies>
            <DefaultRolloverStrategy max="64" />
        </RollingFile>

        <RollingFile name="perfStatsLogFile"
                     append="true"
                     fileName="${log.dir}/perfStats.log"
                     filePattern="${log.dir}/$${date:yyyy-MM}/perfStats-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout pattern="%m%n"/>
            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="16 MB" />
            </Policies>
            <DefaultRolloverStrategy max="64" />
        </RollingFile>
    </Appenders>

    <Loggers>
        <AsyncLogger name="org.jasig" level="info" additivity="false" includeLocation="true">
            <AppenderRef ref="console"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <!--
        <AsyncLogger name="org.opensaml" level="debug" additivity="false">
            <AppenderRef ref="console"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <AsyncLogger name="org.ldaptive" level="debug" additivity="false">
            <AppenderRef ref="console"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <AsyncLogger name="com.hazelcast" level="debug" additivity="false">
            <AppenderRef ref="console"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        -->
        <AsyncLogger name="org.apereo.cas.security" level="warn" additivity="false" includeLocation="true">
            <AppenderRef ref="console"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
            <AppenderRef ref="perfStatsLogFile"/>
        </AsyncLogger>
        <AsyncLogger name="org.jasig.cas.web.flow" level="info" additivity="true" includeLocation="true">
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <AsyncLogger name="org.jasig.inspektr.audit.support" level="info" includeLocation="true">
            <AppenderRef ref="auditLogFile"/>
            <AppenderRef ref="casLogFile"/>
        </AsyncLogger>
        <AsyncLogger level="error">
            <AppenderRef ref="console"/>
            <AppenderRef ref="errorLogFile"/>
        </AsyncLogger>

        <AsyncRoot level="${log.level}">
            <AppenderRef ref="console"/>
            <AppenderRef ref="appLogFile"/>
        </AsyncRoot>
    </Loggers>
</Configuration>
