1 17 18 package org.apache.avalon.logging.log4j; 19 20 import org.apache.avalon.framework.logger.Logger; 21 22 import org.apache.log4j.Level; 23 24 31 public class Log4JLogger 32 implements Logger 33 { 34 private org.apache.log4j.Logger m_Logger; 35 36 Log4JLogger( org.apache.log4j.Logger log4jLogger ) 37 { 38 m_Logger = log4jLogger; 39 } 40 41 46 public void debug( String message ) 47 { 48 m_Logger.debug( message ); 49 } 50 51 57 public void debug( String message, Throwable throwable ) 58 { 59 m_Logger.debug( message, throwable ); 60 } 61 62 67 public boolean isDebugEnabled() 68 { 69 return m_Logger.isDebugEnabled(); 70 } 71 72 77 public void info( String message ) 78 { 79 m_Logger.info( message ); 80 } 81 82 88 public void info( String message, Throwable throwable ) 89 { 90 m_Logger.info( message, throwable ); 91 } 92 93 98 public boolean isInfoEnabled() 99 { 100 return m_Logger.isInfoEnabled(); 101 } 102 103 108 public void warn( String message ) 109 { 110 m_Logger.warn( message ); 111 } 112 113 119 public void warn( String message, Throwable throwable ) 120 { 121 m_Logger.warn( message, throwable ); 122 } 123 124 129 public boolean isWarnEnabled() 130 { 131 return m_Logger.isEnabledFor( Level.WARN ); 132 } 133 134 139 public void error( String message ) 140 { 141 m_Logger.error( message ); 142 } 143 144 150 public void error( String message, Throwable throwable ) 151 { 152 m_Logger.error( message, throwable ); 153 } 154 155 160 public boolean isErrorEnabled() 161 { 162 return m_Logger.isEnabledFor( Level.ERROR ); 163 } 164 165 170 public void fatalError( String message ) 171 { 172 m_Logger.fatal( message ); 173 } 174 175 181 public void fatalError( String message, Throwable throwable ) 182 { 183 m_Logger.fatal( message, throwable ); 184 } 185 186 191 public boolean isFatalErrorEnabled() 192 { 193 return m_Logger.isEnabledFor( Level.FATAL ); 194 } 195 196 204 public Logger getChildLogger( String name ) 205 { 206 String newName = m_Logger.getName() + "." + name; 207 org.apache.log4j.Logger childLog4JLogger = 208 org.apache.log4j.Logger.getLogger( newName ); 209 Log4JLogger child = new Log4JLogger( childLog4JLogger ); 210 return child; 211 } 212 } 213 | Popular Tags |