/*
 * Copyright 2008-2012 by Emeric Vernat
 *
 *     This file is part of Java Melody.
 *
 * Java Melody is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Java Melody 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Java Melody.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.bull.javamelody;

import javax.servlet.http.HttpServletRequest;

/**
 * JavaMelodyLogger pour Log4J.
 * @author Emeric Vernat
 */
public class Log4JLogger implements JavaMelodyLogger {
	private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
			.getLogger(INTERNAL_LOGGER_NAME);

	/** {@inheritDoc} */
	@Override
	public void debug(String msg) {
		LOGGER.debug(msg);
	}

	/** {@inheritDoc} */
	@Override
	public void debug(String msg, Throwable throwable) {
		LOGGER.debug(msg, throwable);
	}

	/** {@inheritDoc} */
	@Override
	public void info(String msg, Throwable throwable) {
		LOGGER.info(msg, throwable);
	}

	/** {@inheritDoc} */
	@Override
	public void warn(String msg, Throwable throwable) {
		LOGGER.warn(msg, throwable);
	}

	/** {@inheritDoc} */
	@Override
	public void logHttpRequest(HttpServletRequest httpRequest, String requestName, long duration,
			boolean systemError, int responseSize, String loggerName) {
		final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(loggerName);
		if (logger.isInfoEnabled()) {
			logger.info(LOG.buildLogMessage(httpRequest, duration, systemError, responseSize));
		}
	}
}

@@ -1135,37 +1135,36 @@
 e%0D%0A%09public void 
-debug
+info
 (String msg) %7B%0D%0A
@@ -1158,39 +1158,70 @@
 ring msg
-) %7B%0D%0A%09%09LOGGER.debug(msg
+, Throwable throwable) %7B%0D%0A%09%09LOGGER.info(msg, throwable
 );%0D%0A%09%7D%0D%0A
@@ -1270,21 +1270,20 @@
 ic void 
-debug
+warn
 (String 
@@ -1324,13 +1324,12 @@
 GER.
-debug
+warn
 (msg
@@ -1389,36 +1389,37 @@
 e%0D%0A%09public void 
-info
+debug
 (String msg, Thr
@@ -1417,62 +1417,31 @@
  msg
-, Throwable throwable) %7B%0D%0A%09%09LOGGER.info(msg, throwable
+) %7B%0D%0A%09%09LOGGER.debug(msg
 );%0D%0A
@@ -1486,36 +1486,37 @@
 e%0D%0A%09public void 
-warn
+debug
 (String msg, Thr
@@ -1537,36 +1537,37 @@
 le) %7B%0D%0A%09%09LOGGER.
-warn
+debug
 (msg, throwable)

work around cpd warning