Skip to content
Snippets Groups Projects
Commit 09729b33 authored by ribeaudc's avatar ribeaudc
Browse files

Remove ExtendedLogger and avoid redundancy.

SVN: 222
parent 241135e9
No related merge requests found
/*
* Copyright 2007 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.common.logging;
import org.apache.log4j.Logger;
/**
* This <code>Logger</code> extension checks the priority level before making the logging output.
*
* @author Christian Ribeaud
*/
public final class ExtendedLogger extends Logger
{
public ExtendedLogger(String name)
{
super(name);
}
///////////////////////////////////////////////////////
// Logger
///////////////////////////////////////////////////////
@Override
public final void info(Object message)
{
if (isInfoEnabled())
{
super.info(message);
}
}
@Override
public final void info(Object message, Throwable t)
{
if (isInfoEnabled())
{
super.info(message, t);
}
}
@Override
public final void debug(Object message)
{
if (isDebugEnabled())
{
super.debug(message);
}
}
@Override
public final void debug(Object message, Throwable t)
{
if (isDebugEnabled())
{
super.debug(message, t);
}
}
}
......@@ -17,7 +17,6 @@
package ch.systemsx.cisd.common.logging;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggerFactory;
/**
* This class is used to create loggers (using <code>log4j</code>).
......@@ -49,31 +48,4 @@ public final class LogFactory
{
return Logger.getLogger(getLoggerName(category, clazz));
}
/**
* Returns the logger for the given {@link LogCategory} and {@link Class}. The name of the logger will contain the
* name of the <var>category</var>, followed by the canonical name of <var>clazz</var>.
* <p>
* The returned version of <code>Logger</code> checks the priority level before doing the logging output.
* </p>
*/
public final static Logger getExtendedLogger(LogCategory category, Class clazz) {
return Logger.getLogger(getLoggerName(category, clazz), new ExtendedLoggerFactory());
}
///////////////////////////////////////////////////////
// Helper Classes
///////////////////////////////////////////////////////
private final static class ExtendedLoggerFactory implements LoggerFactory {
///////////////////////////////////////////////////////
// LoggerFactory
///////////////////////////////////////////////////////
public Logger makeNewLoggerInstance(String name)
{
return new ExtendedLogger(name);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment