/** * MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface. * Copyright (C) 2012 Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ /******************************************************************************\ * * This product was developed by * * SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), * * a government company established under Brazilian law (5.615/70), * at Department of Development of Porto Alegre. * \******************************************************************************/ package serpro.mailarchiver.util; import com.google.common.base.Supplier; import org.apache.log4j.Level; import org.apache.log4j.spi.LoggerFactory; public class Logger extends org.apache.log4j.Logger { protected Logger(String name) { super(name); } public static Logger getLocalLogger() { return (Logger) org.apache.log4j.Logger.getLogger( Thread.currentThread().getStackTrace()[2].getClassName(), new LoggerFactory() { @Override public org.apache.log4j.Logger makeNewLoggerInstance(String string) { return new Logger(string); } } ); } //========================================================================== public void fatal(String message) { super.fatal(message); } public void fatal(String format, Object... args) { if(isEnabledFor(Level.FATAL)) { super.fatal(String.format(format, args)); } } public void fatal(String format, Supplier args) { if(isEnabledFor(Level.FATAL)) { super.fatal(String.format(format, args.get())); } } public void fatal(Throwable t, String message) { super.fatal(message, t); } public void fatal(Throwable t, String format, Object... args) { if(isEnabledFor(Level.FATAL)) { super.fatal(String.format(format, args), t); } } public void fatal(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.FATAL)) { super.fatal(String.format(format, args.get()), t); } } //========================================================================== public void error(String message) { super.error(message); } public void error(String format, Object... args) { if(isEnabledFor(Level.ERROR)) { super.error(String.format(format, args)); } } public void error(String format, Supplier args) { if(isEnabledFor(Level.ERROR)) { super.error(String.format(format, args.get())); } } public void error(Throwable t, String message) { super.error(message, t); } public void error(Throwable t, String format, Object... args) { if(isEnabledFor(Level.ERROR)) { super.error(String.format(format, args), t); } } public void error(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.ERROR)) { super.error(String.format(format, args.get()), t); } } //========================================================================== public void warn(String message) { super.warn(message); } public void warn(String format, Object... args) { if(isEnabledFor(Level.WARN)) { super.warn(String.format(format, args)); } } public void warn(String format, Supplier args) { if(isEnabledFor(Level.WARN)) { super.warn(String.format(format, args.get())); } } public void warn(Throwable t, String message) { super.warn(message, t); } public void warn(Throwable t, String format, Object... args) { if(isEnabledFor(Level.WARN)) { super.warn(String.format(format, args), t); } } public void warn(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.WARN)) { super.warn(String.format(format, args.get()), t); } } //========================================================================== public void info(String message) { super.info(message); } public void info(String format, Object... args) { if(isEnabledFor(Level.INFO)) { super.info(String.format(format, args)); } } public void info(String format, Supplier args) { if(isEnabledFor(Level.INFO)) { super.info(String.format(format, args.get())); } } public void info(Throwable t, String message) { super.info(message, t); } public void info(Throwable t, String format, Object... args) { if(isEnabledFor(Level.INFO)) { super.info(String.format(format, args), t); } } public void info(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.INFO)) { super.info(String.format(format, args.get()), t); } } //========================================================================== public void debug(String message) { super.debug(message); } public void debug(String format, Object... args) { if(isEnabledFor(Level.DEBUG)) { super.debug(String.format(format, args)); } } public void debug(String format, Supplier args) { if(isEnabledFor(Level.DEBUG)) { super.debug(String.format(format, args.get())); } } public void debug(Throwable t, String message) { super.debug(message, t); } public void debug(Throwable t, String format, Object... args) { if(isEnabledFor(Level.DEBUG)) { super.debug(String.format(format, args), t); } } public void debug(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.DEBUG)) { super.debug(String.format(format, args.get()), t); } } //========================================================================== public void trace(String message) { super.trace(message); } public void trace(String format, Object... args) { if(isEnabledFor(Level.TRACE)) { super.trace(String.format(format, args)); } } public void trace(String format, Supplier args) { if(isEnabledFor(Level.TRACE)) { super.trace(String.format(format, args.get())); } } public void trace(Throwable t, String message) { super.trace(message, t); } public void trace(Throwable t, String format, Object... args) { if(isEnabledFor(Level.TRACE)) { super.trace(String.format(format, args), t); } } public void trace(Throwable t, String format, Supplier args) { if(isEnabledFor(Level.TRACE)) { super.trace(String.format(format, args.get()), t); } } }