1 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 t = (throwableInformation == null) ? null : throwableInformation.getThrowable(); 22 appender.append(LogLevel.fromLog4JLevel(event.getLevel()), event.getMessage(), t); 23 } 24 25 public void close() { 26 } 28 29 public boolean requiresLayout() { 30 return false; 31 } 32 33 } 34 | Popular Tags |