<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

    <!-- ConsoleAppender -->
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Encoding" value="UTF-8" />
        <!-- ref.) attr : Encoding, ImmediateFlush, Target, Threshold -->
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %5p [%c] %m%n" />
        </layout>
        <!-- String 매칭 되는 Log 삭제
        <filter class="org.apache.log4j.varia.StringMatchFilter">
            <param name="StringToMatch" value="Result" />
            <param name="AcceptOnMatch" value="false" />
        </filter>
        -->
    </appender>
    
    <!-- FileAppender -->
	<appender name="appLog" class="org.apache.log4j.FileAppender">
        <param name="Encoding" value="UTF-8" />
		<param name="File" value="/DES/logs/was/pilot/applog/app.log" />
        <param name="ImmediateFlush" value="true" />
        <param name="Append" value="true" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %5p [%c] %m%n" />
        </layout>
    </appender>
    
    <!-- FileAppender : XML 
	<appender name="appLog" class="org.apache.log4j.FileAppender">
        <param name="Encoding" value="UTF-8" />
		<param name="File" value="/DES/logs/was/pilot/appxmllog/appxml.log" />
        <param name="ImmediateFlush" value="true" />
        <param name="Append" value="true" />
        <layout class="org.apache.log4j.xml.XMLLayout"></layout>
    </appender>
    -->
    
    <!-- RollingFileAppender -->
	<appender name="sqlLog" class="org.apache.log4j.RollingFileAppender">
		<param name="File" value="/DES/logs/was/pilot/sqllog/sql.log" />
        <param name="Append" value="true" />
        <param name="MaxFileSize" value="1000KB" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %5p [%c] %m%n" />
        </layout>
    </appender>    
    
    <!-- JDBCAppender
    <appender name="jdbcAppender" class="org.apache.log4j.jdbc.JDBCAppender">
        <param name="Driver" value="oracle.jdbc.driver.OracleDriver"/>
        <param name="URL" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/>
        <param name="User" value="scott"/>
        <param name="Password" value="tiger"/-->
        <!--param name="bufferSize" value="1"/--><!-- 주석처리 해 둘 것 -->
        <!--param name="Sql" value="INSERT INTO tb_log (message, class, priority, log_date)
              VALUES ('%m', '%l', '%p', '%d')"/>
    </appender>
     -->
    <!-- 
        JDBCAppender를 사용하여 case by case로 DB에 저장을 하게되면 DBMS에 많은 부담을 줄 수 있다.
        AsyncAppender를 사용하여 큐에 쌓았다가 한꺼번에 저장하는 방식을 추천한다.
    <appender name="asyncAppender" class="org.apache.log4j.AsyncAppender">
        <param name="locationInfo" value="false"/>
        <! bufferSize 모아서 보낼 로그 수(이벤트의 수). 디폴트 128
        <param name="bufferSize" value="128"/>
        <appender-ref ref="jdbcAppender" />  
    </appender>
    -->
    
    
    <!-- DailyRollingFileAppender -->
    <appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
        <!-- ref.) attr : FileAppender + DatePattern -->
        <!--param name="File" value="C:/DES/workspace/projects/engineer/src/main/webapp/WEB-INF/logs/sample.log" /-->
        <param name="File" value="/DES/logs/was/pilot/console.log" />
        <param name="Append" value="true" />
        <!--
            SimpleDateFormat 을 따름. ex.) .yyyy-ww : 첫날 기준 매주마다,
            .yyyy-MM            : 월단위 
            .yyyy-MM-ww         : 주단위 
            .yyyy-MM-dd         : 일단위 
            .yyyy-MM-dd-a       : 12시간단위 
            .yyyy-MM-dd-HH      : 시간단위 
            .yyyy-MM-dd-HH-mm   : 매분마다
        -->
        <param name="DatePattern" value="'.'yyyy-MM-dd" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %5p [%c] %m%n" />
        </layout>
    </appender>

    <!-- log SQL with timing information, post execution
     -->
    <logger name="aes" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="console" />
        <appender-ref ref="dailyRollingFile" />
    </logger>
    <logger name="able" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="console" />
    </logger>
    <!--  SQL Result Log -->
    <logger name="java.sql" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="console" />
        <!--appender-ref ref="jdbcAppender"/ --> <!-- Oracle DBMS TABLE 에 로그를 남기고 있음  -->
    </logger>
    <!-- controlling scope -->
    <logger name="org.springframework.web.servlet.DispatcherServlet" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="console" />
    </logger>
    <logger name="org.springframework.web.context.ContextLoader" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="console" />
    </logger>
    
    <logger name="com.nexacro.xapi" additivity="false">
        <level value="FATAL" />
        <appender-ref ref="console" />
    </logger>
    
    <logger name="com.nexacro.performance" additivity="false">
        <level value="TRACE" />
        <appender-ref ref="console" />
    </logger>
    
    <root>
        <priority value ="INFO" />
       
        <appender-ref ref="console"/>
        <!-- 
        <appender-ref ref="dailyRollingFile"/>
         -->
    </root>
</log4j:configuration>
