1 26 27 package org.enhydra.xml.xmlc; 28 29 import org.apache.log4j.Level; 30 31 34 public class Log4jXMLCLogger implements XMLCLogger { 35 36 40 private static final String FQCN = Log4jXMLCLogger.class.getName() + "."; 41 42 private final org.apache.log4j.Logger m_logger; 44 45 50 public Log4jXMLCLogger(final org.apache.log4j.Logger logImpl) { 51 m_logger = logImpl; 52 } 53 54 55 60 public final boolean infoEnabled() { 61 return m_logger.isInfoEnabled(); 62 } 63 64 public final void logInfo(final String message) { 69 m_logger.log(FQCN, Level.INFO, message, null ); 70 } 71 77 public final void logInfo(final String message, final Throwable throwable) { 78 m_logger.log( FQCN, Level.WARN, message, throwable ); 79 } 80 81 86 public final boolean errorEnabled() { 87 return m_logger.isEnabledFor(Level.ERROR); 88 } 89 90 91 96 public final void logError(final String message) { 97 m_logger.log( FQCN, Level.ERROR, message, null ); 98 } 99 100 106 public final void logError(final String message, final Throwable throwable) { 107 m_logger.log( FQCN, Level.ERROR, message, throwable ); 108 } 109 110 111 116 public boolean debugEnabled() { 117 return m_logger.isDebugEnabled(); 118 119 } 120 121 122 127 public final void logDebug(final String message) { 128 m_logger.log(FQCN, Level.DEBUG, message, null ); 129 } 130 131 132 138 public void logDebug(final String message, final Throwable throwable) { 139 m_logger.log( FQCN, Level.DEBUG, message, throwable); 140 } 141 142 150 public final XMLCLogger getChildLogger(final String name) { 151 return new Log4jXMLCLogger( 152 org.apache.log4j.Logger.getLogger(m_logger.getName() + "." + name)); 153 } 154 155 } 156 | Popular Tags |