From e50a736c29c6af71d59a14465f985f991b6e557d Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Sat, 9 Aug 2008 15:05:53 +0000 Subject: [PATCH] * Moved all factory methods in InternalLogger to InternalLoggerFactory * Made InternalLogger an interface --- .../org/jboss/netty/bootstrap/Bootstrap.java | 3 +- .../netty/channel/CompleteChannelFuture.java | 3 +- .../netty/channel/DefaultChannelFuture.java | 3 +- .../netty/channel/DefaultChannelPipeline.java | 3 +- .../netty/channel/SimpleChannelHandler.java | 3 +- .../socket/nio/NioClientSocketChannel.java | 3 +- .../nio/NioClientSocketPipelineSink.java | 3 +- .../socket/nio/NioServerSocketChannel.java | 3 +- .../nio/NioServerSocketPipelineSink.java | 3 +- .../netty/channel/socket/nio/NioWorker.java | 3 +- .../socket/oio/OioServerSocketChannel.java | 3 +- .../oio/OioServerSocketPipelineSink.java | 3 +- .../FactorialClientPipelineFactory.java | 1 + .../FactorialServerPipelineFactory.java | 1 + .../example/telnet/TelnetPipelineFactory.java | 1 + .../netty/logging/CommonsLoggerFactory.java | 14 +------- .../jboss/netty/logging/InternalLogger.java | 34 +++++++------------ .../netty/logging/InternalLoggerFactory.java | 10 +++++- .../netty/logging/JBossLoggerFactory.java | 14 +------- .../jboss/netty/logging/JdkLoggerFactory.java | 14 +------- .../netty/logging/Log4JLoggerFactory.java | 14 +------- .../netty/logging/Slf4JLoggerFactory.java | 14 +------- .../netty/util/NamePreservingRunnable.java | 3 +- 23 files changed, 56 insertions(+), 100 deletions(-) diff --git a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java index 22bebb4c57..0f4994091a 100644 --- a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java @@ -39,6 +39,7 @@ import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; import org.jboss.netty.channel.SimpleChannelHandler; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; /** * @author The Netty Project (netty-dev@lists.jboss.org) @@ -50,7 +51,7 @@ import org.jboss.netty.logging.InternalLogger; */ public class Bootstrap { - private static InternalLogger logger = InternalLogger.getLogger(Bootstrap.class); + private static InternalLogger logger = InternalLoggerFactory.getInstance(Bootstrap.class); private volatile ChannelFactory factory; private volatile ChannelPipeline pipeline = pipeline(); diff --git a/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java b/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java index ef86e82389..738c0f1185 100644 --- a/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java @@ -25,11 +25,12 @@ package org.jboss.netty.channel; import java.util.concurrent.TimeUnit; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; public abstract class CompleteChannelFuture implements ChannelFuture { private static final InternalLogger logger = - InternalLogger.getLogger(CompleteChannelFuture.class); + InternalLoggerFactory.getInstance(CompleteChannelFuture.class); private final Channel channel; diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java b/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java index c3be6e88c9..6af38b64a1 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java @@ -27,12 +27,13 @@ import java.util.List; import java.util.concurrent.TimeUnit; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; public class DefaultChannelFuture implements ChannelFuture { private static final InternalLogger logger = - InternalLogger.getLogger(DefaultChannelFuture.class); + InternalLoggerFactory.getInstance(DefaultChannelFuture.class); private static final int DEAD_LOCK_CHECK_INTERVAL = 5000; private static final Throwable CANCELLED = new Throwable(); diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 37d485358b..6b2f072750 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -31,11 +31,12 @@ import java.util.Map; import java.util.NoSuchElementException; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; public class DefaultChannelPipeline implements ChannelPipeline { - static final InternalLogger logger = InternalLogger.getLogger(DefaultChannelPipeline.class); + static final InternalLogger logger = InternalLoggerFactory.getInstance(DefaultChannelPipeline.class); private final ChannelSink discardingSink = new ChannelSink() { public void eventSunk(ChannelPipeline pipeline, ChannelEvent e) { diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java index ae436fc0f0..403e71ea80 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java @@ -23,6 +23,7 @@ package org.jboss.netty.channel; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; /** @@ -35,7 +36,7 @@ import org.jboss.netty.logging.InternalLogger; public class SimpleChannelHandler implements ChannelUpstreamHandler { private static final InternalLogger logger = - InternalLogger.getLogger(SimpleChannelHandler.class.getName()); + InternalLoggerFactory.getInstance(SimpleChannelHandler.class.getName()); public void handleUpstream( ChannelHandlerContext ctx, ChannelEvent e) throws Exception { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java index bbadce75e2..d8dab258b4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java @@ -33,11 +33,12 @@ import org.jboss.netty.channel.ChannelFuture; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelSink; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; class NioClientSocketChannel extends NioSocketChannel { private static final InternalLogger logger = - InternalLogger.getLogger(NioClientSocketChannel.class); + InternalLoggerFactory.getInstance(NioClientSocketChannel.class); private static SocketChannel newSocket() { SocketChannel socket; diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 73d969285e..8cbf62ca91 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -45,12 +45,13 @@ import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.NamePreservingRunnable; class NioClientSocketPipelineSink extends AbstractChannelSink { static final InternalLogger logger = - InternalLogger.getLogger(NioClientSocketPipelineSink.class); + InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class); private static final AtomicInteger nextId = new AtomicInteger(); final int id = nextId.incrementAndGet(); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java index 40c7a86c28..02a0bdd832 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java @@ -37,12 +37,13 @@ import org.jboss.netty.channel.ChannelSink; import org.jboss.netty.channel.socket.DefaultServerSocketChannelConfig; import org.jboss.netty.channel.socket.ServerSocketChannelConfig; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; class NioServerSocketChannel extends AbstractServerChannel implements org.jboss.netty.channel.socket.ServerSocketChannel { private static final InternalLogger logger = - InternalLogger.getLogger(NioServerSocketChannel.class); + InternalLoggerFactory.getInstance(NioServerSocketChannel.class); final ServerSocketChannel socket; private final ServerSocketChannelConfig config; diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java index ca1cc4ec01..5c90168e36 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java @@ -41,12 +41,13 @@ import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.NamePreservingRunnable; class NioServerSocketPipelineSink extends AbstractChannelSink { static final InternalLogger logger = - InternalLogger.getLogger(NioServerSocketPipelineSink.class); + InternalLoggerFactory.getInstance(NioServerSocketPipelineSink.class); private static final AtomicInteger nextId = new AtomicInteger(); private final int id = nextId.incrementAndGet(); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index fcebab1d0a..ff42a32bdc 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -41,11 +41,12 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelException; import org.jboss.netty.channel.ChannelFuture; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.NamePreservingRunnable; class NioWorker implements Runnable { - private static final InternalLogger logger = InternalLogger.getLogger(NioWorker.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(NioWorker.class); private final int bossId; private final int id; diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java index 665cf50a95..d2fca0f9f5 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java @@ -38,12 +38,13 @@ import org.jboss.netty.channel.socket.DefaultServerSocketChannelConfig; import org.jboss.netty.channel.socket.ServerSocketChannel; import org.jboss.netty.channel.socket.ServerSocketChannelConfig; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; class OioServerSocketChannel extends AbstractServerChannel implements ServerSocketChannel { private static final InternalLogger logger = - InternalLogger.getLogger(OioServerSocketChannel.class); + InternalLoggerFactory.getInstance(OioServerSocketChannel.class); final ServerSocket socket; private final ServerSocketChannelConfig config; diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java index 3efb9eb37a..1b4167a8c8 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java @@ -39,12 +39,13 @@ import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.NamePreservingRunnable; class OioServerSocketPipelineSink extends AbstractChannelSink { static final InternalLogger logger = - InternalLogger.getLogger(OioServerSocketPipelineSink.class); + InternalLoggerFactory.getInstance(OioServerSocketPipelineSink.class); final Executor workerExecutor; diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java index e56a5c2f6b..53db935185 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java @@ -23,6 +23,7 @@ package org.jboss.netty.example.factorial; import static org.jboss.netty.channel.Channels.*; + import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java index 1c9b36dace..2d23203c37 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java @@ -23,6 +23,7 @@ package org.jboss.netty.example.factorial; import static org.jboss.netty.channel.Channels.*; + import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetPipelineFactory.java b/src/main/java/org/jboss/netty/example/telnet/TelnetPipelineFactory.java index 2a400cc71c..a9e0a5355f 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetPipelineFactory.java @@ -23,6 +23,7 @@ package org.jboss.netty.example.telnet; import static org.jboss.netty.channel.Channels.*; + import org.jboss.netty.channel.ChannelHandler; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; diff --git a/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java b/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java index a6ac5847b0..25421b7ed3 100644 --- a/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java @@ -33,66 +33,54 @@ package org.jboss.netty.logging; public class CommonsLoggerFactory extends InternalLoggerFactory { @Override - public InternalLogger getInstance(String name) { + public InternalLogger newInstance(String name) { final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(name); return new InternalLogger() { - @Override public void debug(String msg) { logger.debug(msg); } - @Override public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } - @Override public void error(String msg) { logger.error(msg); } - @Override public void error(String msg, Throwable cause) { logger.error(msg, cause); } - @Override public void info(String msg) { logger.info(msg); } - @Override public void info(String msg, Throwable cause) { logger.info(msg, cause); } - @Override public boolean isDebugEnabled() { return logger.isDebugEnabled(); } - @Override public boolean isErrorEnabled() { return logger.isErrorEnabled(); } - @Override public boolean isInfoEnabled() { return logger.isInfoEnabled(); } - @Override public boolean isWarnEnabled() { return logger.isWarnEnabled(); } - @Override public void warn(String msg) { logger.warn(msg); } - @Override public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } diff --git a/src/main/java/org/jboss/netty/logging/InternalLogger.java b/src/main/java/org/jboss/netty/logging/InternalLogger.java index 8b959fa3b7..9752d6db59 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLogger.java +++ b/src/main/java/org/jboss/netty/logging/InternalLogger.java @@ -29,26 +29,18 @@ package org.jboss.netty.logging; * @version $Rev$, $Date$ * */ -public abstract class InternalLogger { - public static InternalLogger getLogger(Class clazz) { - return getLogger(clazz.getName()); - } +public interface InternalLogger { + boolean isDebugEnabled(); + boolean isInfoEnabled(); + boolean isWarnEnabled(); + boolean isErrorEnabled(); - public static InternalLogger getLogger(String name) { - return InternalLoggerFactory.getDefault().getInstance(name); - } - - public abstract boolean isDebugEnabled(); - public abstract boolean isInfoEnabled(); - public abstract boolean isWarnEnabled(); - public abstract boolean isErrorEnabled(); - - public abstract void debug(String msg); - public abstract void debug(String msg, Throwable cause); - public abstract void info(String msg); - public abstract void info(String msg, Throwable cause); - public abstract void warn(String msg); - public abstract void warn(String msg, Throwable cause); - public abstract void error(String msg); - public abstract void error(String msg, Throwable cause); + void debug(String msg); + void debug(String msg, Throwable cause); + void info(String msg); + void info(String msg, Throwable cause); + void warn(String msg); + void warn(String msg, Throwable cause); + void error(String msg); + void error(String msg, Throwable cause); } diff --git a/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java b/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java index 38c758ef50..4a6977b4cb 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java @@ -43,5 +43,13 @@ public abstract class InternalLoggerFactory { InternalLoggerFactory.defaultInstance = defaultInstance; } - public abstract InternalLogger getInstance(String name); + public static InternalLogger getInstance(Class clazz) { + return getInstance(clazz); + } + + public static InternalLogger getInstance(String name) { + return getDefault().newInstance(name); + } + + public abstract InternalLogger newInstance(String name); } diff --git a/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java b/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java index f96feb6586..d4114174f7 100644 --- a/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java @@ -33,68 +33,56 @@ package org.jboss.netty.logging; public class JBossLoggerFactory extends InternalLoggerFactory { @Override - public InternalLogger getInstance(String name) { + public InternalLogger newInstance(String name) { final org.jboss.logging.Logger logger = org.jboss.logging.Logger.getLogger(name); return new InternalLogger() { - @Override public void debug(String msg) { logger.debug(msg); } - @Override public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } - @Override public void error(String msg) { logger.error(msg); } - @Override public void error(String msg, Throwable cause) { logger.error(msg, cause); } - @Override public void info(String msg) { logger.info(msg); } - @Override public void info(String msg, Throwable cause) { logger.info(msg, cause); } - @Override @SuppressWarnings("deprecation") public boolean isDebugEnabled() { return logger.isDebugEnabled(); } - @Override public boolean isErrorEnabled() { return true; } - @Override @SuppressWarnings("deprecation") public boolean isInfoEnabled() { return logger.isInfoEnabled(); } - @Override public boolean isWarnEnabled() { return true; } - @Override public void warn(String msg) { logger.warn(msg); } - @Override public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } diff --git a/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java b/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java index 11e7bd051d..c569a1838b 100644 --- a/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java @@ -34,66 +34,54 @@ import java.util.logging.Level; public class JdkLoggerFactory extends InternalLoggerFactory { @Override - public InternalLogger getInstance(String name) { + public InternalLogger newInstance(String name) { final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(name); return new InternalLogger() { - @Override public void debug(String msg) { logger.log(Level.FINE, msg); } - @Override public void debug(String msg, Throwable cause) { logger.log(Level.FINE, msg, cause); } - @Override public void error(String msg) { logger.log(Level.SEVERE, msg); } - @Override public void error(String msg, Throwable cause) { logger.log(Level.SEVERE, msg, cause); } - @Override public void info(String msg) { logger.log(Level.INFO, msg); } - @Override public void info(String msg, Throwable cause) { logger.log(Level.INFO, msg, cause); } - @Override public boolean isDebugEnabled() { return logger.isLoggable(Level.FINE); } - @Override public boolean isErrorEnabled() { return logger.isLoggable(Level.SEVERE); } - @Override public boolean isInfoEnabled() { return logger.isLoggable(Level.INFO); } - @Override public boolean isWarnEnabled() { return logger.isLoggable(Level.WARNING); } - @Override public void warn(String msg) { logger.log(Level.WARNING, msg); } - @Override public void warn(String msg, Throwable cause) { logger.log(Level.WARNING, msg, cause); } diff --git a/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java b/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java index 41f6a5f796..834ed4daae 100644 --- a/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java @@ -33,66 +33,54 @@ package org.jboss.netty.logging; public class Log4JLoggerFactory extends InternalLoggerFactory { @Override - public InternalLogger getInstance(String name) { + public InternalLogger newInstance(String name) { final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(name); return new InternalLogger() { - @Override public void debug(String msg) { logger.debug(msg); } - @Override public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } - @Override public void error(String msg) { logger.error(msg); } - @Override public void error(String msg, Throwable cause) { logger.error(msg, cause); } - @Override public void info(String msg) { logger.info(msg); } - @Override public void info(String msg, Throwable cause) { logger.info(msg, cause); } - @Override public boolean isDebugEnabled() { return logger.isDebugEnabled(); } - @Override public boolean isErrorEnabled() { return true; } - @Override public boolean isInfoEnabled() { return logger.isInfoEnabled(); } - @Override public boolean isWarnEnabled() { return true; } - @Override public void warn(String msg) { logger.warn(msg); } - @Override public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } diff --git a/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java b/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java index 9b1de6d3d5..33c23ff632 100644 --- a/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java @@ -33,66 +33,54 @@ package org.jboss.netty.logging; public class Slf4JLoggerFactory extends InternalLoggerFactory { @Override - public InternalLogger getInstance(String name) { + public InternalLogger newInstance(String name) { final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(name); return new InternalLogger() { - @Override public void debug(String msg) { logger.debug(msg); } - @Override public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } - @Override public void error(String msg) { logger.error(msg); } - @Override public void error(String msg, Throwable cause) { logger.error(msg, cause); } - @Override public void info(String msg) { logger.info(msg); } - @Override public void info(String msg, Throwable cause) { logger.info(msg, cause); } - @Override public boolean isDebugEnabled() { return logger.isDebugEnabled(); } - @Override public boolean isErrorEnabled() { return logger.isErrorEnabled(); } - @Override public boolean isInfoEnabled() { return logger.isInfoEnabled(); } - @Override public boolean isWarnEnabled() { return logger.isWarnEnabled(); } - @Override public void warn(String msg) { logger.warn(msg); } - @Override public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } diff --git a/src/main/java/org/jboss/netty/util/NamePreservingRunnable.java b/src/main/java/org/jboss/netty/util/NamePreservingRunnable.java index 519377435f..ac72b55312 100644 --- a/src/main/java/org/jboss/netty/util/NamePreservingRunnable.java +++ b/src/main/java/org/jboss/netty/util/NamePreservingRunnable.java @@ -23,10 +23,11 @@ package org.jboss.netty.util; import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; public class NamePreservingRunnable implements Runnable { private static final InternalLogger logger = - InternalLogger.getLogger(NamePreservingRunnable.class); + InternalLoggerFactory.getInstance(NamePreservingRunnable.class); private final String newName; private final Runnable runnable;