사용자 도구

사이트 도구


java:log4j

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
java:log4j [2012/12/05 12:12]
kwon37xi [비동기 로깅]
java:log4j [2022/01/13 13:53] (현재)
kwon37xi
줄 1: 줄 1:
 ====== Log4j ====== ====== Log4j ======
   * http://logging.apache.org/log4j/   * http://logging.apache.org/log4j/
 +  * [[java:log4j2|Log4j2]] 를 사용할 것
   * [[http://onjava.com/pub/a/onjava/2002/08/07/log4j.html|Build Flexible Logs With log4j - O'Reilly Media]] : Log4j 기본을 잘 설명하고 있다.   * [[http://onjava.com/pub/a/onjava/2002/08/07/log4j.html|Build Flexible Logs With log4j - O'Reilly Media]] : Log4j 기본을 잘 설명하고 있다.
   * [[java:log4j:pattern|Log4j 로그 패턴]]   * [[java:log4j:pattern|Log4j 로그 패턴]]
   * [[java:log4j:jdbcappender|Log4j JDBCAppender]]   * [[java:log4j:jdbcappender|Log4j JDBCAppender]]
   * [[java:log4j:xml|Log4j XML 설정]]   * [[java:log4j:xml|Log4j XML 설정]]
 +  * [[java:log4j:async|비동기 로깅]]
 +  * [[java:log4j:socketappender|SocketAppender & SocketHubAppender]]
 +  * [[java:log4j:smtp|SMTP Appender]]
 +  * [[java:log4j:rewrite_appender|Rewrite Appender]]
   * [[http://logging.apache.org/chainsaw/|ChainSaw]] Log4j의 로그를 Socket으로 받아서 보여준다.   * [[http://logging.apache.org/chainsaw/|ChainSaw]] Log4j의 로그를 Socket으로 받아서 보여준다.
   * [[http://logdigger.com/|LogDigger]] FireFox에서 log4j 로그를 본다.   * [[http://logdigger.com/|LogDigger]] FireFox에서 log4j 로그를 본다.
   * [[https://github.com/jakubholynet/blog/tree/master/stat4j|Stat4j]]   * [[https://github.com/jakubholynet/blog/tree/master/stat4j|Stat4j]]
 +
 +===== reload4j =====
 +  * [[https://reload4j.qos.ch/|reload4j]] : log4j 1.2.x 버전이 장기적으로 유지보수가 안돼서 생긴 보안 이슈를 해결한 버전. log4j 1.x 사용자는 이걸로 바꿔치기 하는게 좋음.
 +
  
 ===== additivity ===== ===== additivity =====
   * 중복으로 로그가 쌓인다면, 로거에 ''additivity'' 속성을 ''false''로 지정한다.   * 중복으로 로그가 쌓인다면, 로거에 ''additivity'' 속성을 ''false''로 지정한다.
  
-===== 비동기 깅 ===== +===== Appender별 그 레벨 ===== 
-  * [[http://ricardozuasti.com/2009/asynchronous-logging-with-log4j/|Asynchronous logging with log4j]] +  * [[http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AppenderSkeleton.html|AppenderSkeleton]]을 상속한 경우<code> 
-  * [[http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AsyncAppender.html|AsyncAppender]] +log4j.appender.[AppenderName].Threshold=[로그레벨] 
-  * [[http://knight76.tistory.com/entry/log4j-AsyncAppender-%EC%82%AC%EC%9A%A9%EC%8B%9C-%EC%9C%A0%EC%9D%98%EC%82%AC%ED%95%AD|log4j AsyncAppender 사용시 유의사항]] +</code> 
-    * convertion pattern에서 ''%F:%L'' 사용시 ?:? 로 발생할 수 있다. +  * [[http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/varia/LevelRangeFilter.html|LevelRangeFilter]] 사용<code xml> 
-    * ''<param name="locationInfo" value="true"/>'' 를 추가해야 한다. +<appender name="[AppenderName]class="[AppenderClass]"> 
- +  .... 
-<code xml> +  <filter class="org.apache.log4j.varia.LevelRangeFilter"> 
-<?xml version="1.0encoding="UTF-8"?+    <param name="LevelMin" value="error" /> 
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" > +    <param name="LevelMax" value="fatal" /> 
-<log4j:configuration> +  </filter
-    <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> +</appender> 
-        <layout class="org.apache.log4j.PatternLayout"> +</code>
-            <param name="ConversionPattern" value="%d{yyyy/MM/dd HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n"/+
-        </layout+
-    </appender> +
-    <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> +
-        <param name="BufferSize" value="500"/> +
-        <appender-ref ref="stdout"/> +
-    </appender+
-    <root> +
-        <priority value="error"></priority> +
-        <appender-ref ref="ASYNC"/> +
-    </root> +
-</log4j:configuration+
-</code>  +
- +
-  * 주의 할 점들 +
-    * If you see duplicated entries on your log, make sure your logger has the additivity attribute set to false. +
-    * The BufferSize parameter of the AsyncAppender defines the number of entries that will be stored in memory to let the actual appender catch up flushing them to their final destination. If this buffer fills up, the logging will switch to a synchronous mode until buffer space becomes available, potentially becoming a performance issue. Make sure this buffer is big enough, taking into account the IO speed and number of log entries generated by your application. +
-    * You can add the Blocking parameter to the AsyncAppender definition in your config file, if you set it to false (the default value is true) when the buffer fills up, the appender will discard log events until new buffer space becomes available. This can be unacceptable in applications where logging information is critical, but on the other hand can be very desirable where performance is a critical factor. +
java/log4j.1354677174.txt.gz · 마지막으로 수정됨: 2012/12/05 12:12 저자 kwon37xi