1 16 17 package org.apache.commons.logging.log4j.log4j12; 18 19 20 import java.util.List ; 21 22 import org.apache.commons.logging.log4j.StandardTests; 23 import org.apache.log4j.AppenderSkeleton; 24 import org.apache.log4j.spi.LoggingEvent; 25 26 32 33 public class TestAppender extends AppenderSkeleton { 34 35 38 public TestAppender(List logEvents) { 39 events = logEvents; 40 } 41 42 44 45 private List events; 47 48 49 51 protected void append(LoggingEvent event) { 52 StandardTests.LogEvent lev = new StandardTests.LogEvent(); 53 54 lev.level = event.getLevel().toString(); 55 56 if (event.getMessage() == null) 57 lev.msg = null; 58 else 59 lev.msg = event.getMessage().toString(); 60 61 if (event.getThrowableInformation() == null) 62 lev.throwable = null; 63 else 64 lev.throwable = event.getThrowableInformation().getThrowable(); 65 66 events.add(lev); 67 } 68 69 70 public void close() { 71 } 72 73 74 public boolean requiresLayout() { 75 return (false); 76 } 77 78 79 } 80 | Popular Tags |