<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2018 Scytl Secure Electronic Voting SA

    All rights reserved

    See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package

-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
                     debug="true">

    <appender name="DebugFile" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="target/logs/debug-log4j.log"/>
        <layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        </layout>
    </appender>
    <appender name="InfoFile" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="target/logs/info-log4j.log"/>
        <layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        </layout>
    </appender>
    <appender name="WarnFile" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="target/logs/warn-log4j.log"/>
        <layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        </layout>
    </appender>
    <appender name="ErrorFile" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="target/logs/error-log4j.log"/>
        <layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        </layout>
    </appender>

    <appender name="SecureErrorFile" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="target/logs/secure-error-log4j.log"/>
        <layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        </layout>
    </appender>

    <appender name="secure-appender" class="com.scytl.slogger.SecureAppender">
        <errorHandler class="com.scytl.slogger.SecureErrorHandler">
            <appender-ref ref="SecureErrorFile"/>
        </errorHandler>
        <param name="file" value="target/logs/secure_log4j.log" />
        <param name="pattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS}|%p|%t|%m%n" />
        <param name="verifyPattern" value="TIMESTAMP|LEVEL|THREAD|MESSAGE" />
        <!-- New checkpoint each 10000 lines -->
        <param name="numberLogLines" value="10000" />
        <!-- New checkpoint each 300000ms = 5min -->
        <param name="timerLogMilliseconds" value="300000" />
        <!-- New log file each 3600000ms = 1h -->
        <param name="triggeringTime" value="3600000" />
        <!--<param name="pkcs12File" value="cipherKeyStore.p12" />-->
        <!--<param name="pkcs12Password" value="649VRY52GXXCNJH48X5F" />-->
        <!-- for version 3.0.6 of SecureLogger -->
        <param name="signaturePkcs12FileName" value="signatureKeyStore.p12" />
        <param name="signaturePkcs12Password" value="GXXCNJH48X5F649VRY52" />
        <param name="cipherPkcs12FileName" value="cipherKeyStore.p12" />
        <param name="cipherPkcs12Password" value="649VRY52GXXCNJH48X5F" />
        <param name="encoding" value="UTF-8" />
        <param name="logFileNamePolicyName" value="SINGLE_FILENAME" />
    </appender>

    <logger name="SecureLogger" additivity="false">
        <level value="INFO" />
        <appender-ref ref="secure-appender" />
    </logger>

    <root>
        <level value="DEBUG"/>
        <appender-ref ref="DebugFile"/>
        <appender-ref ref="InfoFile"/>
        <appender-ref ref="WarnFile"/>
        <appender-ref ref="ErrorFile"/>
    </root>

</log4j:configuration>
