封装 lo4j (转)-02
public void info(Object message) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, message);}}public void info(Object message, Throwable t) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, message, t);}}public void info(String pattern, Object... arguments) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, format(pattern, arguments));}}public void info(String pattern, Throwable t, Object... arguments) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, format(pattern, arguments), t);}}public void warn(Object message) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, message);}}public void warn(Object message, Throwable t) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, message, t);}}public void warn(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, format(pattern, arguments));}}public void warn(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, format(pattern, arguments), t);}}public void error(Object message) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, message);}}public void error(Object message, Throwable t) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, message, t);}}public void error(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, format(pattern, arguments));}}public void error(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, format(pattern, arguments), t);}}public void fatal(Object message) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, message);}}public void fatal(Object message, Throwable t) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, message, t);}}public void fatal(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, format(pattern, arguments));}}public void fatal(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, format(pattern, arguments), t);}}public void assertLog(boolean assertion, String message) {if (!assertion) {forcedLog(logger, Level.ERROR, message);}}private static void forcedLog(Logger logger, Level level, Object message) {logger.callAppenders(new LoggingEvent(FQCN, logger, level, message, null));}private static void forcedLog(Logger logger, Level level, Object message, Throwable t) {logger.callAppenders(new LoggingEvent(FQCN, logger, level, message, t));}private static String format(String pattern, Object... arguments) {return MessageFormat.format(pattern, arguments);}}?