JAMES-2113 Protocol should use SLF4J for its logging
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/07c9e3ce Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/07c9e3ce Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/07c9e3ce Branch: refs/heads/master Commit: 07c9e3ceab58fc88ce6dab1c1d9ecd0b0eb88f1c Parents: 5d2e6a6 Author: benwa <btell...@linagora.com> Authored: Thu Aug 10 17:21:28 2017 +0700 Committer: benwa <btell...@linagora.com> Committed: Thu Aug 17 11:20:29 2017 +0700 ---------------------------------------------------------------------- .../apache/james/protocols/api/Protocol.java | 2 +- .../james/protocols/api/ProtocolImpl.java | 2 +- .../james/protocols/api/ProtocolSession.java | 2 +- .../protocols/api/ProtocolSessionImpl.java | 2 +- .../api/future/FutureResponseImpl.java | 5 +- .../api/handler/CommandHandlerResultLogger.java | 2 +- .../protocols/api/logger/ContextualLogger.java | 302 +++++++++++++---- .../james/protocols/api/logger/Logger.java | 167 ---------- .../api/logger/ProtocolLoggerAdapter.java | 92 ------ .../protocols/lmtp/AbstractLMTPServerTest.java | 3 +- .../netty/BasicChannelUpstreamHandler.java | 2 +- .../james/protocols/pop3/POP3Protocol.java | 2 +- .../james/protocols/pop3/POP3SessionImpl.java | 2 +- .../protocols/pop3/AbstractPOP3ServerTest.java | 3 +- .../pop3/AbstractStartTlsPOP3ServerTest.java | 3 +- .../james/protocols/smtp/SMTPProtocol.java | 4 +- .../james/protocols/smtp/SMTPSessionImpl.java | 4 +- .../protocols/smtp/AbstractSMTPServerTest.java | 3 +- .../smtp/netty/NettyStartTlsSMTPServerTest.java | 3 +- .../smtp/utils/BaseFakeSMTPSession.java | 5 +- .../netty/ImapChannelUpstreamHandler.java | 9 +- .../james/protocols/lib/Slf4jLoggerAdapter.java | 320 ------------------- .../hook/MailboxDeliverToRecipientHandler.java | 3 +- .../james/lmtpserver/netty/LMTPServer.java | 3 +- .../ManageSieveChannelUpstreamHandler.java | 9 +- .../james/pop3server/core/PassCmdHandler.java | 3 +- .../james/pop3server/netty/POP3Server.java | 3 +- .../james/smtpserver/ExtendedSMTPSession.java | 3 +- .../james/smtpserver/netty/SMTPServer.java | 3 +- 29 files changed, 266 insertions(+), 700 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/Protocol.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/Protocol.java b/protocols/api/src/main/java/org/apache/james/protocols/api/Protocol.java index 00c47b3..551fda2 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/Protocol.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/Protocol.java @@ -20,7 +20,7 @@ package org.apache.james.protocols.api; import org.apache.james.protocols.api.handler.ProtocolHandlerChain; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * Define a protocol http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolImpl.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolImpl.java b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolImpl.java index d82cb9f..003aed4 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolImpl.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolImpl.java @@ -20,7 +20,7 @@ package org.apache.james.protocols.api; import org.apache.james.protocols.api.handler.ProtocolHandlerChain; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * Basic {@link Protocol} implementation http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSession.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSession.java b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSession.java index 212748d..6fc3609 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSession.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSession.java @@ -24,7 +24,7 @@ import java.nio.charset.Charset; import java.util.Map; import org.apache.james.protocols.api.handler.LineHandler; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * Session for a protocol. Every new connection generates a new session http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSessionImpl.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSessionImpl.java b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSessionImpl.java index 227f005..9a5f8d8 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSessionImpl.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolSessionImpl.java @@ -26,7 +26,7 @@ import java.util.Map; import org.apache.james.protocols.api.handler.LineHandler; import org.apache.james.protocols.api.logger.ContextualLogger; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * Basic implementation of {@link ProtocolSession} http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/future/FutureResponseImpl.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/future/FutureResponseImpl.java b/protocols/api/src/main/java/org/apache/james/protocols/api/future/FutureResponseImpl.java index 1716d25..09859c4 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/future/FutureResponseImpl.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/future/FutureResponseImpl.java @@ -24,8 +24,7 @@ import java.util.List; import org.apache.james.protocols.api.AbstractResponse; import org.apache.james.protocols.api.Response; -import org.apache.james.protocols.api.logger.Logger; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** @@ -38,7 +37,7 @@ public class FutureResponseImpl implements FutureResponse{ private final Logger logger; public FutureResponseImpl() { - this(new ProtocolLoggerAdapter(LoggerFactory.getLogger(FutureResponseImpl.class))); + this(LoggerFactory.getLogger(FutureResponseImpl.class)); } public FutureResponseImpl(Logger logger) { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java index 47ac3ea..0d15cf6 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java @@ -22,7 +22,7 @@ import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.james.protocols.api.ProtocolSession; import org.apache.james.protocols.api.Response; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ContextualLogger.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ContextualLogger.java b/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ContextualLogger.java index dcccc60..367c386 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ContextualLogger.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ContextualLogger.java @@ -20,14 +20,15 @@ package org.apache.james.protocols.api.logger; import java.util.function.Supplier; - import org.apache.james.protocols.api.ProtocolSession; +import org.slf4j.Logger; +import org.slf4j.Marker; /** * {@link Logger} which adds context informations to the logged message. * */ -public class ContextualLogger implements Logger { +public class ContextualLogger implements org.slf4j.Logger { private final Supplier<String> userSupplier; private final String sessionId; @@ -54,128 +55,295 @@ public class ContextualLogger implements Logger { sb.append("' ").append(str); return sb.toString(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#debug(java.lang.String) - */ + public void debug(String arg0) { logger.debug(getText(arg0)); } - - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#debug(java.lang.String, java.lang.Throwable) - */ public void debug(String arg0, Throwable arg1) { logger.debug(getText(arg0), arg1); } - - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#error(java.lang.String) - */ public void error(String arg0) { logger.error(getText(arg0)); } - - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#error(java.lang.String, java.lang.Throwable) - */ public void error(String arg0, Throwable arg1) { logger.error(getText(arg0), arg1); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#info(java.lang.String) - */ public void info(String arg0) { logger.info(getText(arg0)); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#info(java.lang.String, java.lang.Throwable) - */ public void info(String arg0, Throwable arg1) { logger.info(getText(arg0), arg1); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#isDebugEnabled() - */ public boolean isDebugEnabled() { return logger.isDebugEnabled(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#isErrorEnabled() - */ public boolean isErrorEnabled() { return logger.isErrorEnabled(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#isInfoEnabled() - */ public boolean isInfoEnabled() { return logger.isInfoEnabled(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#isTraceEnabled() - */ public boolean isTraceEnabled() { return logger.isTraceEnabled(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#isWarnEnabled() - */ public boolean isWarnEnabled() { return logger.isWarnEnabled(); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#trace(java.lang.String) - */ public void trace(String arg0) { logger.trace(getText(arg0)); } - - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#trace(java.lang.String, java.lang.Throwable) - */ + public void trace(String arg0, Throwable arg1) { logger.trace(getText(arg0), arg1); } - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#warn(java.lang.String) - */ public void warn(String arg0) { logger.warn(getText(arg0)); } - - /* - * (non-Javadoc) - * @see org.apache.james.protocols.api.logger.Logger#warn(java.lang.String, java.lang.Throwable) - */ public void warn(String arg0, Throwable arg1) { logger.warn(getText(arg0), arg1); } + @Override + public String getName() { + return logger.getName(); + } + + @Override + public void trace(String format, Object arg) { + logger.trace(getText(format), arg); + } + + @Override + public void trace(String format, Object arg1, Object arg2) { + logger.trace(getText(format), arg1, arg2); + } + + @Override + public void trace(String format, Object[] argArray) { + logger.trace(getText(format), argArray); + } + + @Override + public boolean isTraceEnabled(Marker marker) { + return logger.isTraceEnabled(marker); + } + + @Override + public void trace(Marker marker, String msg) { + logger.trace(marker, getText(msg)); + } + + @Override + public void trace(Marker marker, String format, Object arg) { + logger.trace(marker, getText(format), arg); + } + + @Override + public void trace(Marker marker, String format, Object arg1, Object arg2) { + logger.trace(marker, getText(format), arg1, arg2); + } + + @Override + public void trace(Marker marker, String format, Object[] argArray) { + logger.trace(marker, getText(format), argArray); + } + + @Override + public void trace(Marker marker, String msg, Throwable t) { + logger.trace(marker, getText(msg), t); + + } + + @Override + public void debug(String format, Object arg) { + logger.debug(getText(format), arg); + } + + @Override + public void debug(String format, Object arg1, Object arg2) { + logger.debug(getText(format), arg1, arg2); + } + + @Override + public void debug(String format, Object[] argArray) { + logger.debug(getText(format), argArray); + } + + @Override + public boolean isDebugEnabled(Marker marker) { + return logger.isTraceEnabled(marker); + } + + @Override + public void debug(Marker marker, String msg) { + logger.debug(marker, getText(msg)); + } + + @Override + public void debug(Marker marker, String format, Object arg) { + logger.debug(marker, getText(format), arg); + } + + @Override + public void debug(Marker marker, String format, Object arg1, Object arg2) { + logger.debug(marker, getText(format), arg1, arg2); + } + + @Override + public void debug(Marker marker, String format, Object[] argArray) { + logger.debug(marker, getText(format), argArray); + } + + @Override + public void debug(Marker marker, String msg, Throwable t) { + logger.debug(marker, getText(msg), t); + } + + @Override + public void info(String format, Object arg) { + logger.info(getText(format), arg); + } + + @Override + public void info(String format, Object arg1, Object arg2) { + logger.info(getText(format), arg1, arg2); + } + + @Override + public void info(String format, Object[] argArray) { + logger.info(getText(format), argArray); + } + + @Override + public boolean isInfoEnabled(Marker marker) { + return logger.isInfoEnabled(marker); + } + + @Override + public void info(Marker marker, String msg) { + logger.info(marker, getText(msg)); + } + + @Override + public void info(Marker marker, String format, Object arg) { + logger.info(marker, getText(format), arg); + } + + @Override + public void info(Marker marker, String format, Object arg1, Object arg2) { + logger.info(marker, getText(format), arg1, arg2); + } + + @Override + public void info(Marker marker, String format, Object[] argArray) { + logger.info(marker, getText(format), argArray); + } + + @Override + public void info(Marker marker, String msg, Throwable t) { + logger.info(marker, getText(msg), t); + } + + @Override + public void warn(String format, Object arg) { + logger.warn(getText(format), arg); + } + + @Override + public void warn(String format, Object[] argArray) { + logger.warn(getText(format), argArray); + } + + @Override + public void warn(String format, Object arg1, Object arg2) { + logger.warn(getText(format), arg1, arg2); + } + + @Override + public boolean isWarnEnabled(Marker marker) { + return logger.isWarnEnabled(marker); + } + + @Override + public void warn(Marker marker, String msg) { + logger.warn(marker, getText(msg)); + } + + @Override + public void warn(Marker marker, String format, Object arg) { + logger.warn(marker, getText(format), arg); + } + + @Override + public void warn(Marker marker, String format, Object arg1, Object arg2) { + logger.warn(marker, getText(format), arg1, arg2); + } + + @Override + public void warn(Marker marker, String format, Object[] argArray) { + logger.warn(marker, getText(format), argArray); + } + + @Override + public void warn(Marker marker, String msg, Throwable t) { + logger.warn(marker, getText(msg), t); + } + + @Override + public void error(String format, Object arg) { + logger.error(getText(format), arg); + } + + @Override + public void error(String format, Object arg1, Object arg2) { + logger.error(getText(format), arg1, arg2); + } + + @Override + public void error(String format, Object[] argArray) { + logger.error(getText(format), argArray); + } + + @Override + public boolean isErrorEnabled(Marker marker) { + return logger.isErrorEnabled(marker); + } + + @Override + public void error(Marker marker, String msg) { + logger.error(marker, getText(msg)); + } + + @Override + public void error(Marker marker, String format, Object arg) { + logger.error(marker, getText(format), arg); + } + + @Override + public void error(Marker marker, String format, Object arg1, Object arg2) { + logger.error(marker, getText(format), arg1, arg2); + } + + @Override + public void error(Marker marker, String format, Object[] argArray) { + logger.error(marker, getText(format), argArray); + } + + @Override + public void error(Marker marker, String msg, Throwable t) { + logger.error(marker, getText(msg), t); + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/logger/Logger.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/Logger.java b/protocols/api/src/main/java/org/apache/james/protocols/api/logger/Logger.java deleted file mode 100644 index bc0621f..0000000 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/Logger.java +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you 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 org.apache.james.protocols.api.logger; - -public interface Logger { - - /** - * <p> Is debug logging currently enabled? </p> - * - * <p> Call this method to prevent having to perform expensive operations - * (for example, <code>String</code> concatenation) - * when the log level is more than debug. </p> - * - * @return true if debug is enabled in the underlying logger. - */ - boolean isDebugEnabled(); - - - /** - * <p> Is error logging currently enabled? </p> - * - * <p> Call this method to prevent having to perform expensive operations - * (for example, <code>String</code> concatenation) - * when the log level is more than error. </p> - * - * @return true if error is enabled in the underlying logger. - */ - boolean isErrorEnabled(); - - /** - * <p> Is info logging currently enabled? </p> - * - * <p> Call this method to prevent having to perform expensive operations - * (for example, <code>String</code> concatenation) - * when the log level is more than info. </p> - * - * @return true if info is enabled in the underlying logger. - */ - boolean isInfoEnabled(); - - - /** - * <p> Is trace logging currently enabled? </p> - * - * <p> Call this method to prevent having to perform expensive operations - * (for example, <code>String</code> concatenation) - * when the log level is more than trace. </p> - * - * @return true if trace is enabled in the underlying logger. - */ - boolean isTraceEnabled(); - - - /** - * <p> Is warn logging currently enabled? </p> - * - * <p> Call this method to prevent having to perform expensive operations - * (for example, <code>String</code> concatenation) - * when the log level is more than warn. </p> - * - * @return true if warn is enabled in the underlying logger. - */ - boolean isWarnEnabled(); - - - /** - * <p> Log a message with trace log level. </p> - * - * @param message log this message - */ - void trace(String message); - - - /** - * <p> Log an error with trace log level. </p> - * - * @param message log this message - * @param t log this cause - */ - void trace(String message, Throwable t); - - - /** - * <p> Log a message with debug log level. </p> - * - * @param message log this message - */ - void debug(String message); - - - /** - * <p> Log an error with debug log level. </p> - * - * @param message log this message - * @param t log this cause - */ - void debug(String message, Throwable t); - - - /** - * <p> Log a message with info log level. </p> - * - * @param message log this message - */ - void info(String message); - - - /** - * <p> Log an error with info log level. </p> - * - * @param message log this message - * @param t log this cause - */ - void info(String message, Throwable t); - - - /** - * <p> Log a message with warn log level. </p> - * - * @param message log this message - */ - void warn(String message); - - - /** - * <p> Log an error with warn log level. </p> - * - * @param message log this message - * @param t log this cause - */ - void warn(String message, Throwable t); - - - /** - * <p> Log a message with error log level. </p> - * - * @param message log this message - */ - void error(String message); - - - /** - * <p> Log an error with error log level. </p> - * - * @param message log this message - * @param t log this cause - */ - void error(String message, Throwable t); -} http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ProtocolLoggerAdapter.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ProtocolLoggerAdapter.java b/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ProtocolLoggerAdapter.java deleted file mode 100644 index 404cc85..0000000 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/logger/ProtocolLoggerAdapter.java +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you 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 org.apache.james.protocols.api.logger; -/** - * Adapter class for SLF4J - * - */ -public class ProtocolLoggerAdapter implements Logger{ - - private final org.slf4j.Logger logger; - - public ProtocolLoggerAdapter(org.slf4j.Logger logger) { - this.logger = logger; - } - - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - public void trace(String message) { - logger.trace(message); - } - - public void trace(String message, Throwable t) { - logger.trace(message, t); - } - - public void debug(String message) { - logger.debug(message); - } - - public void debug(String message, Throwable t) { - logger.debug(message, t); - } - - public void info(String message) { - logger.info(message); - } - - public void info(String message, Throwable t) { - logger.info(message, t); - } - - public void warn(String message) { - logger.warn(message); - } - - public void warn(String message, Throwable t) { - logger.warn(message, t); - } - - public void error(String message) { - logger.error(message); - } - - public void error(String message, Throwable t) { - logger.error(message, t); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java index 26a6ba8..2a7ccc7 100644 --- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java +++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java @@ -38,7 +38,6 @@ import org.apache.james.protocols.api.Protocol; import org.apache.james.protocols.api.ProtocolServer; import org.apache.james.protocols.api.handler.ProtocolHandler; import org.apache.james.protocols.api.handler.WiringException; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.api.utils.ProtocolServerUtils; import org.apache.james.protocols.lmtp.hook.DeliverToRecipientHook; import org.apache.james.protocols.smtp.AbstractSMTPServerTest; @@ -72,7 +71,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest{ } chain.addAll(0, hList); chain.wireExtensibleHandlers(); - return new SMTPProtocol(chain, new LMTPConfigurationImpl(), new ProtocolLoggerAdapter(LOGGER)); + return new SMTPProtocol(chain, new LMTPConfigurationImpl(), LOGGER); } http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java ---------------------------------------------------------------------- diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java index 26e6ee8..2b7c481 100644 --- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java +++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelUpstreamHandler.java @@ -35,7 +35,6 @@ import org.apache.james.protocols.api.handler.DisconnectHandler; import org.apache.james.protocols.api.handler.LineHandler; import org.apache.james.protocols.api.handler.ProtocolHandlerChain; import org.apache.james.protocols.api.handler.ProtocolHandlerResultHandler; -import org.apache.james.protocols.api.logger.Logger; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandler.Sharable; @@ -46,6 +45,7 @@ import org.jboss.netty.channel.ExceptionEvent; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.SimpleChannelUpstreamHandler; import org.jboss.netty.handler.codec.frame.TooLongFrameException; +import org.slf4j.Logger; /** * {@link ChannelUpstreamHandler} which is used by the SMTPServer and other line based protocols http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Protocol.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Protocol.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Protocol.java index c0c43df..5da598e 100644 --- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Protocol.java +++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Protocol.java @@ -24,7 +24,7 @@ import org.apache.james.protocols.api.ProtocolImpl; import org.apache.james.protocols.api.ProtocolSession; import org.apache.james.protocols.api.ProtocolTransport; import org.apache.james.protocols.api.handler.ProtocolHandlerChain; -import org.apache.james.protocols.api.logger.Logger; +import org.slf4j.Logger; /** * {@link ProtocolImpl} which implements the POP3 Protocol http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3SessionImpl.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3SessionImpl.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3SessionImpl.java index 6fb4900..a473edd 100644 --- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3SessionImpl.java +++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3SessionImpl.java @@ -22,8 +22,8 @@ import org.apache.james.protocols.api.ProtocolConfiguration; import org.apache.james.protocols.api.ProtocolSessionImpl; import org.apache.james.protocols.api.ProtocolTransport; import org.apache.james.protocols.api.Response; -import org.apache.james.protocols.api.logger.Logger; import org.apache.james.protocols.pop3.mailbox.Mailbox; +import org.slf4j.Logger; /** * {@link POP3Session} implementation which use Netty http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java index e74aee6..6595106 100644 --- a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java +++ b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java @@ -34,7 +34,6 @@ import org.apache.commons.net.pop3.POP3Reply; import org.apache.james.protocols.api.Protocol; import org.apache.james.protocols.api.ProtocolServer; import org.apache.james.protocols.api.handler.WiringException; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.api.utils.ProtocolServerUtils; import org.apache.james.protocols.pop3.core.AbstractApopCmdHandler; import org.apache.james.protocols.pop3.core.AbstractPassCmdHandler; @@ -53,7 +52,7 @@ public abstract class AbstractPOP3ServerTest { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractPOP3ServerTest.class); private POP3Protocol createProtocol(AbstractPassCmdHandler handler) throws WiringException { - return new POP3Protocol(new POP3ProtocolHandlerChain(handler), new POP3Configuration(), new ProtocolLoggerAdapter(LOGGER)); + return new POP3Protocol(new POP3ProtocolHandlerChain(handler), new POP3Configuration(), LOGGER); } protected abstract ProtocolServer createServer(Protocol protocol); http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java index d660145..e556946 100644 --- a/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java +++ b/protocols/pop3/src/test/java/org/apache/james/protocols/pop3/AbstractStartTlsPOP3ServerTest.java @@ -30,7 +30,6 @@ import org.apache.james.protocols.api.Encryption; import org.apache.james.protocols.api.Protocol; import org.apache.james.protocols.api.ProtocolServer; import org.apache.james.protocols.api.handler.WiringException; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.api.utils.BogusSslContextFactory; import org.apache.james.protocols.api.utils.BogusTrustManagerFactory; import org.apache.james.protocols.api.utils.ProtocolServerUtils; @@ -48,7 +47,7 @@ public abstract class AbstractStartTlsPOP3ServerTest { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractStartTlsPOP3ServerTest.class); private POP3Protocol createProtocol(AbstractPassCmdHandler handler) throws WiringException { - return new POP3Protocol(new POP3ProtocolHandlerChain(handler), new POP3Configuration(), new ProtocolLoggerAdapter(LOGGER)); + return new POP3Protocol(new POP3ProtocolHandlerChain(handler), new POP3Configuration(), LOGGER); } protected POP3SClient createClient() { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocol.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocol.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocol.java index cefb6d9..9b50145 100644 --- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocol.java +++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPProtocol.java @@ -23,9 +23,7 @@ import org.apache.james.protocols.api.ProtocolImpl; import org.apache.james.protocols.api.ProtocolSession; import org.apache.james.protocols.api.ProtocolTransport; import org.apache.james.protocols.api.handler.ProtocolHandlerChain; -import org.apache.james.protocols.api.logger.Logger; -import org.apache.james.protocols.smtp.SMTPConfiguration; -import org.apache.james.protocols.smtp.SMTPSessionImpl; +import org.slf4j.Logger; /** * {@link ProtocolImpl} which creates {@link SMTPSessionImpl} instances http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPSessionImpl.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPSessionImpl.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPSessionImpl.java index 124e30f..dbf8fdd 100644 --- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPSessionImpl.java +++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPSessionImpl.java @@ -23,9 +23,7 @@ import java.util.Collection; import org.apache.james.protocols.api.ProtocolSessionImpl; import org.apache.james.protocols.api.ProtocolTransport; import org.apache.james.protocols.api.Response; -import org.apache.james.protocols.api.logger.Logger; -import org.apache.james.protocols.smtp.SMTPConfiguration; -import org.apache.james.protocols.smtp.SMTPSession; +import org.slf4j.Logger; /** * {@link SMTPSession} implementation http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java index e3504e6..19d2421 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java @@ -43,7 +43,6 @@ import org.apache.james.protocols.api.handler.ConnectHandler; import org.apache.james.protocols.api.handler.DisconnectHandler; import org.apache.james.protocols.api.handler.ProtocolHandler; import org.apache.james.protocols.api.handler.WiringException; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.api.utils.ProtocolServerUtils; import org.apache.james.protocols.smtp.hook.HeloHook; import org.apache.james.protocols.smtp.hook.HookResult; @@ -1104,7 +1103,7 @@ public abstract class AbstractSMTPServerTest { SMTPProtocolHandlerChain chain = new SMTPProtocolHandlerChain(new NoopMetricFactory()); chain.addAll(0, Arrays.asList(handlers)); chain.wireExtensibleHandlers(); - return new SMTPProtocol(chain, new SMTPConfigurationImpl(), new ProtocolLoggerAdapter(LOGGER)); + return new SMTPProtocol(chain, new SMTPConfigurationImpl(), LOGGER); } protected static void checkEnvelope(MailEnvelope env, String sender, List<String> recipients, String msg) throws IOException { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java index accfb73..0178f0a 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java @@ -39,7 +39,6 @@ import org.apache.james.protocols.api.Protocol; import org.apache.james.protocols.api.ProtocolServer; import org.apache.james.protocols.api.handler.ProtocolHandler; import org.apache.james.protocols.api.handler.WiringException; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.api.utils.BogusSSLSocketFactory; import org.apache.james.protocols.api.utils.BogusSslContextFactory; import org.apache.james.protocols.api.utils.BogusTrustManagerFactory; @@ -102,7 +101,7 @@ public class NettyStartTlsSMTPServerTest { chain.add(handler.get()); } chain.wireExtensibleHandlers(); - return new SMTPProtocol(chain, new SMTPConfigurationImpl(), new ProtocolLoggerAdapter(LOGGER)); + return new SMTPProtocol(chain, new SMTPConfigurationImpl(), LOGGER); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/BaseFakeSMTPSession.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/BaseFakeSMTPSession.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/BaseFakeSMTPSession.java index 7282c38..78b7e64 100644 --- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/BaseFakeSMTPSession.java +++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/BaseFakeSMTPSession.java @@ -27,10 +27,9 @@ import java.util.Map; import org.apache.james.protocols.api.ProtocolSession; import org.apache.james.protocols.api.Response; import org.apache.james.protocols.api.handler.LineHandler; -import org.apache.james.protocols.api.logger.Logger; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.smtp.SMTPConfiguration; import org.apache.james.protocols.smtp.SMTPSession; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** @@ -38,7 +37,7 @@ import org.slf4j.LoggerFactory; */ public class BaseFakeSMTPSession implements SMTPSession { - private static final Logger log = new ProtocolLoggerAdapter(LoggerFactory.getLogger(BaseFakeSMTPSession.class)); + private static final Logger log = LoggerFactory.getLogger(BaseFakeSMTPSession.class); @Override public boolean needsCommandInjectionDetection() { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java index 0c5da20..48b522e 100644 --- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java +++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java @@ -35,9 +35,7 @@ import org.apache.james.imap.encode.base.ImapResponseComposerImpl; import org.apache.james.imap.main.ResponseEncoder; import org.apache.james.metrics.api.Metric; import org.apache.james.protocols.api.logger.ContextualLogger; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.imap.IMAPSession; -import org.apache.james.protocols.lib.Slf4jLoggerAdapter; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFutureListener; @@ -97,11 +95,10 @@ public class ImapChannelUpstreamHandler extends SimpleChannelUpstreamHandler imp } private Logger getLogger(final ChannelHandlerContext ctx) { - return new Slf4jLoggerAdapter( - new ContextualLogger( + return new ContextualLogger( getUserSupplier(ctx), - "" + ctx.getChannel().getId(), - new ProtocolLoggerAdapter(logger))); + String.valueOf(ctx.getChannel().getId()), + logger); } private Supplier<String> getUserSupplier(final ChannelHandlerContext ctx) { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/Slf4jLoggerAdapter.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/Slf4jLoggerAdapter.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/Slf4jLoggerAdapter.java deleted file mode 100644 index 4f42bd0..0000000 --- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/Slf4jLoggerAdapter.java +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you 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 org.apache.james.protocols.lib; - -import org.apache.james.protocols.api.logger.Logger; -import org.slf4j.Marker; - -/** - * Adapter class for SLF4J - * - */ -public class Slf4jLoggerAdapter implements org.slf4j.Logger { - - private final Logger logger; - - public Slf4jLoggerAdapter(Logger logger) { - this.logger = logger; - } - - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - public void trace(String message) { - logger.trace(message); - } - - public void trace(String message, Throwable t) { - logger.trace(message, t); - } - - public void debug(String message) { - logger.debug(message); - } - - public void debug(String message, Throwable t) { - logger.debug(message, t); - } - - public void info(String message) { - logger.info(message); - } - - public void info(String message, Throwable t) { - logger.info(message, t); - } - - public void warn(String message) { - logger.warn(message); - } - - public void warn(String message, Throwable t) { - logger.warn(message, t); - } - - public void error(String message) { - logger.error(message); - } - - public void error(String message, Throwable t) { - logger.error(message, t); - } - - public void debug(String arg0, Object arg1) { - throw new UnsupportedOperationException(); - - } - - public void debug(String arg0, Object... arg1) { - throw new UnsupportedOperationException(); - - } - - public void debug(Marker arg0, String arg1) { - throw new UnsupportedOperationException(); - - } - - public void debug(String arg0, Object arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void debug(Marker arg0, String arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void debug(Marker arg0, String arg1, Object... arg2) { - throw new UnsupportedOperationException(); - - } - - public void debug(Marker arg0, String arg1, Throwable arg2) { - throw new UnsupportedOperationException(); - - } - - public void debug(Marker arg0, String arg1, Object arg2, Object arg3) { - throw new UnsupportedOperationException(); - - } - - public void error(String arg0, Object arg1) { - throw new UnsupportedOperationException(); - - } - - public void error(String arg0, Object... arg1) { - throw new UnsupportedOperationException(); - - } - - public void error(Marker arg0, String arg1) { - throw new UnsupportedOperationException(); - - } - - public void error(String arg0, Object arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void error(Marker arg0, String arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void error(Marker arg0, String arg1, Object... arg2) { - throw new UnsupportedOperationException(); - - } - - public void error(Marker arg0, String arg1, Throwable arg2) { - throw new UnsupportedOperationException(); - - } - - public void error(Marker arg0, String arg1, Object arg2, Object arg3) { - throw new UnsupportedOperationException(); - - } - - public String getName() { - return logger.getClass().getCanonicalName(); - } - - public void info(String arg0, Object arg1) { - throw new UnsupportedOperationException(); - - } - - public void info(String arg0, Object... arg1) { - throw new UnsupportedOperationException(); - - } - - public void info(Marker arg0, String arg1) { - throw new UnsupportedOperationException(); - - } - - public void info(String arg0, Object arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void info(Marker arg0, String arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void info(Marker arg0, String arg1, Object... arg2) { - throw new UnsupportedOperationException(); - - } - - public void info(Marker arg0, String arg1, Throwable arg2) { - throw new UnsupportedOperationException(); - - } - - public void info(Marker arg0, String arg1, Object arg2, Object arg3) { - throw new UnsupportedOperationException(); - - } - - public boolean isDebugEnabled(Marker arg0) { - throw new UnsupportedOperationException(); - } - - public boolean isErrorEnabled(Marker arg0) { - throw new UnsupportedOperationException(); - } - - public boolean isInfoEnabled(Marker arg0) { - throw new UnsupportedOperationException(); - } - - public boolean isTraceEnabled(Marker arg0) { - throw new UnsupportedOperationException(); - } - - public boolean isWarnEnabled(Marker arg0) { - throw new UnsupportedOperationException(); - } - - public void trace(String arg0, Object arg1) { - throw new UnsupportedOperationException(); - - } - - public void trace(String arg0, Object... arg1) { - throw new UnsupportedOperationException(); - - } - - public void trace(Marker arg0, String arg1) { - throw new UnsupportedOperationException(); - - } - - public void trace(String arg0, Object arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void trace(Marker arg0, String arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void trace(Marker arg0, String arg1, Object... arg2) { - throw new UnsupportedOperationException(); - - } - - public void trace(Marker arg0, String arg1, Throwable arg2) { - throw new UnsupportedOperationException(); - - } - - public void trace(Marker arg0, String arg1, Object arg2, Object arg3) { - throw new UnsupportedOperationException(); - - } - - public void warn(String arg0, Object arg1) { - throw new UnsupportedOperationException(); - - } - - public void warn(String arg0, Object... arg1) { - throw new UnsupportedOperationException(); - - } - - public void warn(Marker arg0, String arg1) { - throw new UnsupportedOperationException(); - - } - - public void warn(String arg0, Object arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void warn(Marker arg0, String arg1, Object arg2) { - throw new UnsupportedOperationException(); - - } - - public void warn(Marker arg0, String arg1, Object... arg2) { - throw new UnsupportedOperationException(); - - } - - public void warn(Marker arg0, String arg1, Throwable arg2) { - throw new UnsupportedOperationException(); - - } - - public void warn(Marker arg0, String arg1, Object arg2, Object arg3) { - throw new UnsupportedOperationException(); - - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java index 11d93b8..4645ef8 100644 --- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java +++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java @@ -31,7 +31,6 @@ import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.protocols.lib.Slf4jLoggerAdapter; import org.apache.james.protocols.lmtp.hook.DeliverToRecipientHook; import org.apache.james.protocols.smtp.MailAddress; import org.apache.james.protocols.smtp.MailEnvelope; @@ -76,7 +75,7 @@ public class MailboxDeliverToRecipientHandler implements DeliverToRecipientHook username = recipient.getLocalPart(); } - MailboxSession mailboxSession = mailboxManager.createSystemSession(username, new Slf4jLoggerAdapter(session.getLogger())); + MailboxSession mailboxSession = mailboxManager.createSystemSession(username, session.getLogger()); MailboxPath inbox = MailboxPath.inbox(mailboxSession); mailboxManager.startProcessingRequest(mailboxSession); http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java index 422e8ef..f1b97a8 100644 --- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java +++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java @@ -23,7 +23,6 @@ import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.james.lmtpserver.CoreCmdHandlerLoader; import org.apache.james.lmtpserver.jmx.JMXHandlersLoader; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.lib.handler.HandlersPackage; import org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer; import org.apache.james.protocols.lmtp.LMTPConfiguration; @@ -144,7 +143,7 @@ public class LMTPServer extends AbstractProtocolAsyncServer implements LMTPServe @Override protected ChannelUpstreamHandler createCoreHandler() { - SMTPProtocol protocol = new SMTPProtocol(getProtocolHandlerChain(), lmtpConfig, new ProtocolLoggerAdapter(getLogger())); + SMTPProtocol protocol = new SMTPProtocol(getProtocolHandlerChain(), lmtpConfig, getLogger()); return new SMTPChannelUpstreamHandler(protocol, getLogger(), lmtpMetrics); } http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveChannelUpstreamHandler.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveChannelUpstreamHandler.java b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveChannelUpstreamHandler.java index 6533c1f..11b182f 100644 --- a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveChannelUpstreamHandler.java +++ b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveChannelUpstreamHandler.java @@ -29,8 +29,6 @@ import org.apache.james.managesieve.api.SessionTerminatedException; import org.apache.james.managesieve.transcode.ManageSieveProcessor; import org.apache.james.managesieve.util.SettableSession; import org.apache.james.protocols.api.logger.ContextualLogger; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; -import org.apache.james.protocols.lib.Slf4jLoggerAdapter; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFutureListener; @@ -127,10 +125,9 @@ public class ManageSieveChannelUpstreamHandler extends SimpleChannelUpstreamHand } private Logger getLogger(final ChannelHandlerContext ctx) { - return new Slf4jLoggerAdapter( - new ContextualLogger(getUserSupplier(ctx), - "" + ctx.getChannel().getId(), - new ProtocolLoggerAdapter(logger))); + return new ContextualLogger(getUserSupplier(ctx), + Integer.toString(ctx.getChannel().getId()), + logger); } private Supplier<String> getUserSupplier(final ChannelHandlerContext ctx) { http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java index 120848c..03eed97 100644 --- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java +++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java @@ -33,7 +33,6 @@ import org.apache.james.pop3server.mailbox.MailboxAdapter; import org.apache.james.protocols.api.Request; import org.apache.james.protocols.api.Response; import org.apache.james.protocols.lib.POP3BeforeSMTPHelper; -import org.apache.james.protocols.lib.Slf4jLoggerAdapter; import org.apache.james.protocols.pop3.POP3Response; import org.apache.james.protocols.pop3.POP3Session; import org.apache.james.protocols.pop3.core.AbstractPassCmdHandler; @@ -66,7 +65,7 @@ public class PassCmdHandler extends AbstractPassCmdHandler { protected Mailbox auth(POP3Session session, String username, String password) throws Exception { MailboxSession mSession = null; try { - mSession = manager.login(session.getUser(), password, new Slf4jLoggerAdapter(session.getLogger())); + mSession = manager.login(session.getUser(), password, session.getLogger()); manager.startProcessingRequest(mSession); MailboxPath inbox = MailboxPath.inbox(mSession); http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java index 5a4acb5..4f07010 100644 --- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java +++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java @@ -21,7 +21,6 @@ package org.apache.james.pop3server.netty; import org.apache.james.pop3server.core.CoreCmdHandlerLoader; import org.apache.james.pop3server.jmx.JMXHandlersLoader; import org.apache.james.protocols.api.ProtocolConfiguration; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.lib.handler.HandlersPackage; import org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer; import org.apache.james.protocols.netty.AbstractChannelPipelineFactory; @@ -79,7 +78,7 @@ public class POP3Server extends AbstractProtocolAsyncServer implements POP3Serve @Override protected void preInit() throws Exception { super.preInit(); - POP3Protocol protocol = new POP3Protocol(getProtocolHandlerChain(), theConfigData, new ProtocolLoggerAdapter(getLogger())); + POP3Protocol protocol = new POP3Protocol(getProtocolHandlerChain(), theConfigData, getLogger()); coreHandler = new BasicChannelUpstreamHandler(protocol, getEncryption()); } http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/ExtendedSMTPSession.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/ExtendedSMTPSession.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/ExtendedSMTPSession.java index 83337e1..fb19c67 100644 --- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/ExtendedSMTPSession.java +++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/ExtendedSMTPSession.java @@ -19,7 +19,6 @@ package org.apache.james.smtpserver; import org.apache.james.protocols.api.ProtocolTransport; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.smtp.SMTPConfiguration; import org.apache.james.protocols.smtp.SMTPSession; import org.apache.james.smtpserver.netty.SMTPServer.SMTPHandlerConfigurationDataImpl; @@ -33,7 +32,7 @@ public class ExtendedSMTPSession extends org.apache.james.protocols.smtp.SMTPSes private final SMTPConfiguration smtpConfiguration; public ExtendedSMTPSession(SMTPConfiguration smtpConfiguration, Logger logger, ProtocolTransport transport) { - super(new ProtocolLoggerAdapter(logger), transport, smtpConfiguration); + super(logger, transport, smtpConfiguration); this.smtpConfiguration = smtpConfiguration; } http://git-wip-us.apache.org/repos/asf/james-project/blob/07c9e3ce/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java ---------------------------------------------------------------------- diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java index db3bbe9..46e74de 100644 --- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java +++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java @@ -28,7 +28,6 @@ import org.apache.james.dnsservice.api.DNSService; import org.apache.james.dnsservice.library.netmatcher.NetMatcher; import org.apache.james.protocols.api.ProtocolSession; import org.apache.james.protocols.api.ProtocolTransport; -import org.apache.james.protocols.api.logger.ProtocolLoggerAdapter; import org.apache.james.protocols.lib.handler.HandlersPackage; import org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer; import org.apache.james.protocols.netty.AbstractChannelPipelineFactory; @@ -112,7 +111,7 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe } authorizedNetworks = new NetMatcher(networks, dns); } - SMTPProtocol transport = new SMTPProtocol(getProtocolHandlerChain(), theConfigData, new ProtocolLoggerAdapter(getLogger())) { + SMTPProtocol transport = new SMTPProtocol(getProtocolHandlerChain(), theConfigData, getLogger()) { @Override public ProtocolSession newSession(ProtocolTransport transport) { --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org