KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > logging > Log4JAappenderToTCAppender


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.logging;
6
7 import org.apache.log4j.AppenderSkeleton;
8 import org.apache.log4j.spi.LoggingEvent;
9 import org.apache.log4j.spi.ThrowableInformation;
10
11 class Log4JAappenderToTCAppender extends AppenderSkeleton {
12
13   private final TCAppender appender;
14
15   public Log4JAappenderToTCAppender(TCAppender appender) {
16     this.appender = appender;
17   }
18
19   protected void append(LoggingEvent event) {
20     ThrowableInformation throwableInformation = event.getThrowableInformation();
21     Throwable JavaDoc t = (throwableInformation == null) ? null : throwableInformation.getThrowable();
22     appender.append(LogLevel.fromLog4JLevel(event.getLevel()), event.getMessage(), t);
23   }
24
25   public void close() {
26   //
27
}
28
29   public boolean requiresLayout() {
30     return false;
31   }
32
33 }
34
Popular Tags