1 17 package org.apache.log.output; 18 19 import org.apache.log.LogTarget; 20 import org.apache.log.util.Closeable; 21 22 30 public abstract class AbstractWrappingTarget 31 extends AbstractTarget 32 { 33 private final boolean m_closeWrapped; 34 private final LogTarget m_wrappedLogTarget; 35 36 45 public AbstractWrappingTarget( final LogTarget logTarget, final boolean closeWrappedTarget ) 46 { 47 m_wrappedLogTarget = logTarget; 48 m_closeWrapped = closeWrappedTarget; 49 } 50 51 57 public AbstractWrappingTarget( final LogTarget logTarget ) 58 { 59 this( logTarget, false ); 60 } 61 62 public void close() 63 { 64 super.close(); 65 66 if( m_closeWrapped && m_wrappedLogTarget instanceof Closeable ) 67 { 68 ( (Closeable)m_wrappedLogTarget ).close(); 69 } 70 } 71 72 75 protected final LogTarget getLogTarget() 76 { 77 return m_wrappedLogTarget; 78 } 79 } | Popular Tags |