01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.logging;
06:
07: import org.apache.log4j.AppenderSkeleton;
08: import org.apache.log4j.spi.LoggingEvent;
09: 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
21: .getThrowableInformation();
22: Throwable t = (throwableInformation == null) ? null
23: : throwableInformation.getThrowable();
24: appender.append(LogLevel.fromLog4JLevel(event.getLevel()),
25: event.getMessage(), t);
26: }
27:
28: public void close() {
29: //
30: }
31:
32: public boolean requiresLayout() {
33: return false;
34: }
35:
36: }
|