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

	<springProperty scope="context" name="cdrPath" source="OPENVIDU_CDR_PATH" />

	<timestamp key="myTimestamp" timeReference="contextBirth"
		datePattern="HH-mm-ss" />
	<appender name="STDOUT"
		class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<if
				condition='property("logging.colors").equalsIgnoreCase("true")'>
				<then>
					<pattern>%black(%highlight([%p]) %d{dd MMM HH:mm:ss.SSS} %magenta([%.15t]) \(%file:%line\) - %msg%n)</pattern>
				</then>
				<else>
					<pattern>[%p] %d [%.15t] %c - %msg%n
					</pattern>
				</else>
			</if>
		</encoder>
	</appender>

	<!--<appender name="CUSTOMCLASS"
		class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>%highlight([%p]) %d %magenta([%.15t]) %boldGreen(%c \(%M\) - %msg%n)
			</pattern>
		</encoder>
	</appender>
	<logger
		name="io.openvidu.server.kurento.core.KurentoSessionManager">
		<appender-ref ref="CUSTOMCLASS" />
	</logger>-->

	<root>
		<level value="INFO" />
		<appender-ref ref="STDOUT" />
	</root>
	<if condition='property("OPENVIDU_CDR").equalsIgnoreCase("true")'>
		<then>
			<appender name="CDR"
				class="ch.qos.logback.core.rolling.RollingFileAppender">
				<rollingPolicy
					class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
					<FileNamePattern>${cdrPath}/CDR.%d{yyyy-MM-dd}_${myTimestamp}.log
					</FileNamePattern>
					<MaxHistory>30</MaxHistory>
					<TotalSizeCap>20GB</TotalSizeCap>
				</rollingPolicy>
				<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
					<charset>UTF-8</charset>
					<pattern>%m\n</pattern>
				</encoder>
			</appender>
			<logger name="io.openvidu.server.cdr.CDRLoggerFile">
				<level value="INFO" />
				<appender-ref ref="CDR" />
			</logger>
		</then>
	</if>
</configuration>