1 4 package com.tc.logging; 5 6 import org.apache.log4j.Appender; 7 import org.apache.log4j.Layout; 8 import org.apache.log4j.spi.ErrorHandler; 9 import org.apache.log4j.spi.Filter; 10 import org.apache.log4j.spi.LoggingEvent; 11 12 import com.tc.util.Assert; 13 14 public class DelegatingAppender implements Appender { 15 16 private Appender delegate; 17 18 public DelegatingAppender(Appender delegate) { 19 Assert.assertNotNull(delegate); 20 this.delegate = delegate; 21 } 22 23 private synchronized Appender delegate() { 24 return this.delegate; 25 } 26 27 public synchronized Appender setDelegate(Appender delegate) { 28 Assert.assertNotNull(delegate); 29 Appender out = this.delegate; 30 this.delegate = delegate; 31 return out; 32 } 33 34 public void addFilter(Filter arg0) { 35 delegate().addFilter(arg0); 36 } 37 38 public void clearFilters() { 39 delegate().clearFilters(); 40 } 41 42 public void close() { 43 delegate().close(); 44 } 45 46 public void doAppend(LoggingEvent arg0) { 47 delegate().doAppend(arg0); 48 } 49 50 public ErrorHandler getErrorHandler() { 51 return delegate().getErrorHandler(); 52 } 53 54 public Filter getFilter() { 55 return delegate().getFilter(); 56 } 57 58 public Layout getLayout() { 59 return delegate().getLayout(); 60 } 61 62 public String getName() { 63 return delegate().getName(); 64 } 65 66 public boolean requiresLayout() { 67 return delegate().requiresLayout(); 68 } 69 70 public void setErrorHandler(ErrorHandler arg0) { 71 delegate().setErrorHandler(arg0); 72 } 73 74 public void setLayout(Layout arg0) { 75 delegate().setLayout(arg0); 76 } 77 78 public void setName(String arg0) { 79 delegate().setName(arg0); 80 } 81 82 } 83 | Popular Tags |