1 22 package org.jboss.aspects.logging; 23 24 import org.apache.log4j.AppenderSkeleton; 25 import org.apache.log4j.spi.LoggingEvent; 26 27 import java.util.ArrayList ; 28 29 35 public class ThreadLocalAppender 36 extends AppenderSkeleton 37 { 38 40 public static final String LOG = "InvocationLog"; 41 42 private static ThreadLocal loggingTL = new ThreadLocal (); 43 44 46 48 53 public static ArrayList getList() 54 { 55 return (ArrayList ) loggingTL.get(); 56 } 57 58 63 public static void setList(ArrayList list) 64 { 65 loggingTL.set(list); 66 } 67 68 70 72 74 protected void append(LoggingEvent event) 75 { 76 ArrayList logging = getList(); 77 if (logging == null) 78 return; 79 80 logging.add(event); 81 } 82 83 public boolean requiresLayout() 84 { 85 return false; 86 } 87 88 public void close() 89 { 90 } 91 92 94 96 98 } 100 | Popular Tags |