<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">

	<property name="LOG_HOME" value="${LOG_HOME}/audio-analysis-%d{yyyy-MM-dd_HH}-%i.log" />
	<property name="CONSOLE_LOG_PATTERN"
		value="[%X{username} %X{ip} %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}] : %msg%n" />

	<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
		<encoder charset="UTF-8">
			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
		</encoder>
	</appender>

	<appender name="file"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>${LOG_HOME}</FileNamePattern>
			<MaxHistory>90</MaxHistory>
			<TimeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<MaxFileSize>20MB</MaxFileSize>
			</TimeBasedFileNamingAndTriggeringPolicy>
		</rollingPolicy>

		<encoder>
			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
		</encoder>
	</appender>
	<appender name="plumelog" class="com.plumelog.logback.appender.RedisAppender">
		<appName>cooleshow-audio</appName>
		<redisHost>10.206.0.13:26379,10.206.0.16:26379,10.206.0.8:26379</redisHost>
		<redisAuth>dyym</redisAuth>
		<model>sentinel</model>
		<masterName>mymaster</masterName>
		<env>prod</env>
		<redisDb>10</redisDb>
		<runModel>2</runModel>
	</appender>

	<logger name="com.yonge" level="info" />

	<!--开发环境:打印控制台 -->
	<springProfile name="local">
		<root level="info">
			<appender-ref ref="stdout" />
			<appender-ref ref="file" />
		</root>
	</springProfile>

	<!--开发环境:打印控制台 -->
	<springProfile name="dev">
		<root level="info">
			<appender-ref ref="stdout" />
			<appender-ref ref="file" />
		</root>
	</springProfile>
	
	<springProfile name="test">
		<root level="info">
			<appender-ref ref="stdout" />
			<appender-ref ref="file" />
		</root>
	</springProfile>

	<!--生产环境:输出到文件 -->
	<springProfile name="pre">
		<root level="WARN">
<!--			<appender-ref ref="stdout" />-->
			<appender-ref ref="file" />
			<appender-ref ref="plumelog" />
		</root>
	</springProfile>
	<springProfile name="prod">
		<root level="WARN">
<!--			<appender-ref ref="stdout" />-->
			<appender-ref ref="file" />
			<appender-ref ref="plumelog" />
		</root>
	</springProfile>

</configuration>