1 55 package org.apache.avalon.framework.logger; 56 57 63 public abstract class AbstractLogEnabled 64 implements LogEnabled 65 { 66 private Logger m_logger; 68 69 74 public void enableLogging( final Logger logger ) 75 { 76 m_logger = logger; 77 } 78 79 90 protected final Logger getLogger() 91 { 92 return m_logger; 93 } 94 95 100 protected void setupLogger( final Object component ) 101 { 102 setupLogger( component, (String )null ); 103 } 104 105 112 protected void setupLogger( final Object component, final String subCategory ) 113 { 114 Logger logger = m_logger; 115 116 if( null != subCategory ) 117 { 118 logger = m_logger.getChildLogger( subCategory ); 119 } 120 121 setupLogger( component, logger ); 122 } 123 124 130 protected void setupLogger( final Object component, final Logger logger ) 131 { 132 if( component instanceof LogEnabled ) 133 { 134 ( (LogEnabled)component ).enableLogging( logger ); 135 } 136 } 137 } 138 | Popular Tags |