logback 설정

info는 콘솔
debug는 파일에 남기는 소스
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>WARN</level>
</filter>

 

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

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>%d{yyyy-MM-dd HH:mm:ss:sss} %-5level [%thread] %logger[%method:%line] - %msg%n</Pattern>
        </layout>
    </appender>

    <timestamp key="mTimestamp" datePattern="yyyyMMdd_HHmm" />
    <appender name="FILE" class="ch.qos.logback.core.FileAppender">

        <!-- <file>log/tlogetl.${mTimestamp}.log</file> -->
        <file>log/log/tlogetl.${mTimestamp}.${log.name}.log</file>
        <append>true</append>
        <encoder>
            <Pattern>%d{yyyy-MM-dd HH:mm:ss:sss} %-5level [%thread] %logger[%method:%line] - %msg%n</Pattern>
        </encoder>
    </appender>

    <timestamp key="mTimestamp" datePattern="yyyyMMdd" />
    <appender name="FILE-ERROR" class="ch.qos.logback.core.FileAppender">
        <file>log/error/error.${mTimestamp}.${log.name}.log</file>
        <append>true</append>
        <encoder>
            <Pattern>%d{yyyy-MM-dd HH:mm:ss:sss} %-5level [%thread] %logger[%method:%line] - %msg%n</Pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>WARN</level>
        </filter>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="STDOUT" />
        <appender-ref ref="FILE" />
        <appender-ref ref="FILE-ERROR" />
    </root>
</configuration>

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s