View RSS Feed

Log4j

Logging a Message

Rate this Entry
by , 02-24-2012 at 07:21 PM (699 Views)
To a logger, all messages get logged. Such messages logging is dependent at the methods which correspond to the priority. The interface org.apache.commons.logging.Log details these methods to be used for writing log.
Java Code:
    log.fatal(Object message);
    log.fatal(Object message, Throwable t);
    log.error(Object message);
    log.error(Object message, Throwable t);
    log.warn(Object message);
    log.warn(Object message, Throwable t);
    log.info(Object message);
    log.info(Object message, Throwable t);
    log.debug(Object message);
    log.debug(Object message, Throwable t);
    log.trace(Object message);
    log.trace(Object message, Throwable t);
For these methods, semantics are such that severity of messages is expected to be ordered as given above. Other than logging methods, these would be given out for the code guards:
Java Code:
    log.isFatalEnabled();
    log.isErrorEnabled();
    log.isWarnEnabled();
    log.isInfoEnabled();
    log.isDebugEnabled();
    log.isTraceEnabled();

Submit "Logging a Message" to Facebook Submit "Logging a Message" to Digg Submit "Logging a Message" to del.icio.us Submit "Logging a Message" to StumbleUpon Submit "Logging a Message" to Google

Categories
Commons Lang

Comments