<?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/">
	<root>
		<level value="INFO" />
		<appender-ref ref="console" />
	</root>

	<logger name="splunkable">
		<level value="INFO" />
		<appender-ref ref="splunkableAppender" />
	</logger>

	<logger name="std">
		<level value="INFO" />
		<appender-ref ref="regularAppender" />
	</logger>

	<appender name="console" class="org.apache.log4j.ConsoleAppender">
		<layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
			<param name="ConversionPattern" value="%d{ISO8601} %-5p %c{1}:%L - %m%n" />
		</layout>
	</appender>

	<appender name="splunkableAppender" class="org.apache.log4j.RollingFileAppender">
		<param name="maxBackupIndex" value="10" />
		<param name="file"
			value="${catalina.base}/logs/splunkable.log" />
		<layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
			<param name="ConversionPattern" value="%d{ISO8601}|%p|%t|%m%n" />
		</layout>
	</appender>

	<appender name="regularAppender" class="org.apache.log4j.RollingFileAppender">
		<param name="maxBackupIndex" value="10" />
		<param name="file" value="${catalina.base}/logs/develop.log" />
		<layout class="com.scytl.products.oscore.logging.core.layout.EscapingPatternLayout">
			<param name="ConversionPattern" value="%d{ISO8601}|%p|%t|%m%n" />
		</layout>
	</appender>

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

	<appender name="secure-appender" class="com.scytl.slogger.DeferredSecureAppender">
		<errorHandler class="com.scytl.slogger.SecureErrorHandler">
			<appender-ref ref="SecureErrorFile"/>
		</errorHandler>
		<param name="file" value="${catalina.base}/logs/cr_secure.log" />
		<param name="pattern" value="%d{ISO8601}|%p|%t|%m%n" />
		<param name="verifyPattern" value="TIMESTAMP|LEVEL|THREAD|MESSAGE" />

		<param name="numberLogLines" value="10000" />

		<param name="timerLogMilliseconds" value="300000" />

		<param name="triggeringTime" value="3600000" />

		<param name="encoding" value="UTF-8" />
		<param name="logFileNamePolicyName" value="SEQUENTIAL_DATE_FILENAME" />
	</appender>

	<appender name="SecureErrorFile" class="org.apache.log4j.RollingFileAppender">
		<param name="file" value="${catalina.base}/logs/cr_secure_logger_error.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>

</log4j:configuration>
