dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] chickenlj closed pull request #1717: issue#1447: NettyHelper in netty extension populated Logger "InternalLogger" in netty.
Date Thu, 03 May 2018 07:07:36 GMT
chickenlj closed pull request #1717: issue#1447: NettyHelper in netty extension populated Logger
"InternalLogger" in netty.
URL: https://github.com/apache/incubator-dubbo/pull/1717
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClient.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClient.java
index 73c54b7499..ea273aebfa 100644
--- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClient.java
+++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyClient.java
@@ -25,7 +25,6 @@
 import com.alibaba.dubbo.remoting.ChannelHandler;
 import com.alibaba.dubbo.remoting.RemotingException;
 import com.alibaba.dubbo.remoting.transport.AbstractClient;
-import com.alibaba.dubbo.remoting.transport.netty4.logging.NettyHelper;
 
 import io.netty.bootstrap.Bootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
@@ -58,7 +57,6 @@ public NettyClient(final URL url, final ChannelHandler handler) throws RemotingE
 
     @Override
     protected void doOpen() throws Throwable {
-        NettyHelper.setNettyLoggerFactory();
         final NettyClientHandler nettyClientHandler = new NettyClientHandler(getUrl(), this);
         bootstrap = new Bootstrap();
         bootstrap.group(nioEventLoopGroup)
diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyServer.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyServer.java
index 1924bd16e8..c4ffcf5dde 100644
--- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyServer.java
+++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/NettyServer.java
@@ -28,7 +28,6 @@
 import com.alibaba.dubbo.remoting.Server;
 import com.alibaba.dubbo.remoting.transport.AbstractServer;
 import com.alibaba.dubbo.remoting.transport.dispatcher.ChannelHandlers;
-import com.alibaba.dubbo.remoting.transport.netty4.logging.NettyHelper;
 
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
@@ -68,8 +67,6 @@ public NettyServer(URL url, ChannelHandler handler) throws RemotingException
{
 
     @Override
     protected void doOpen() throws Throwable {
-        NettyHelper.setNettyLoggerFactory();
-
         bootstrap = new ServerBootstrap();
 
         bossGroup = new NioEventLoopGroup(1, new DefaultThreadFactory("NettyServerBoss",
true));
diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/logging/NettyHelper.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/logging/NettyHelper.java
deleted file mode 100644
index 715aa6479d..0000000000
--- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/logging/NettyHelper.java
+++ /dev/null
@@ -1,268 +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 com.alibaba.dubbo.remoting.transport.netty4.logging;
-
-import com.alibaba.dubbo.common.logger.Logger;
-import com.alibaba.dubbo.common.logger.LoggerFactory;
-import io.netty.util.internal.logging.AbstractInternalLogger;
-import io.netty.util.internal.logging.InternalLogger;
-import io.netty.util.internal.logging.InternalLoggerFactory;
-
-public class NettyHelper {
-
-    public static void setNettyLoggerFactory() {
-        InternalLoggerFactory factory = InternalLoggerFactory.getDefaultFactory();
-        if (factory == null || !(factory instanceof DubboLoggerFactory)) {
-            InternalLoggerFactory.setDefaultFactory(new DubboLoggerFactory());
-        }
-    }
-
-    static class DubboLoggerFactory extends InternalLoggerFactory {
-
-        @Override
-        public InternalLogger newInstance(String name) {
-            return new DubboLogger(LoggerFactory.getLogger(name));
-        }
-    }
-
-    static class DubboLogger extends AbstractInternalLogger {
-
-        private Logger logger;
-
-        DubboLogger(Logger logger) {
-            super(logger.getClass().getName());
-            this.logger = logger;
-        }
-
-        @Override
-        public boolean isTraceEnabled() {
-            return logger.isTraceEnabled();
-        }
-
-        @Override
-        public void trace(String msg) {
-            if (isTraceEnabled()) {
-                logger.trace(msg);
-            }
-        }
-
-        @Override
-        public void trace(String format, Object arg) {
-            if (isTraceEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, arg);
-                logger.trace(ft.getMessage(), ft.getThrowable());
-            }
-
-        }
-
-        @Override
-        public void trace(String format, Object argA, Object argB) {
-            if (isTraceEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, argA, argB);
-                logger.trace(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void trace(String format, Object... arguments) {
-            if (isTraceEnabled()) {
-                FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
-                logger.trace(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void trace(String msg, Throwable t) {
-            if (isTraceEnabled()) {
-                logger.trace(msg, t);
-            }
-        }
-
-        @Override
-        public boolean isDebugEnabled() {
-            return logger.isDebugEnabled();
-        }
-
-        @Override
-        public void debug(String msg) {
-            if (isDebugEnabled()) {
-                logger.debug(msg);
-            }
-        }
-
-        @Override
-        public void debug(String format, Object arg) {
-            if (isDebugEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, arg);
-                logger.debug(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void debug(String format, Object argA, Object argB) {
-            if (isDebugEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, argA, argB);
-                logger.debug(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void debug(String format, Object... arguments) {
-            if (isDebugEnabled()) {
-                FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
-                logger.debug(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void debug(String msg, Throwable t) {
-            if (isDebugEnabled()) {
-                logger.debug(msg, t);
-            }
-        }
-
-        @Override
-        public boolean isInfoEnabled() {
-            return logger.isInfoEnabled();
-        }
-
-        @Override
-        public void info(String msg) {
-            if (isInfoEnabled()) {
-                logger.info(msg);
-            }
-        }
-
-        @Override
-        public void info(String format, Object arg) {
-            if (isInfoEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, arg);
-                logger.info(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void info(String format, Object argA, Object argB) {
-            if (isInfoEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, argA, argB);
-                logger.info(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void info(String format, Object... arguments) {
-            if (isInfoEnabled()) {
-                FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
-                logger.info(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void info(String msg, Throwable t) {
-            if (isInfoEnabled()) {
-                logger.info(msg, t);
-            }
-        }
-
-        @Override
-        public boolean isWarnEnabled() {
-            return false;
-        }
-
-        @Override
-        public void warn(String msg) {
-            if (isWarnEnabled()) {
-                logger.warn(msg);
-            }
-        }
-
-        @Override
-        public void warn(String format, Object arg) {
-            if (isWarnEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, arg);
-                logger.warn(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void warn(String format, Object... arguments) {
-            if (isWarnEnabled()) {
-                FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
-                logger.warn(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void warn(String format, Object argA, Object argB) {
-            if (isWarnEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, argA, argB);
-                logger.warn(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void warn(String msg, Throwable t) {
-            if (isWarnEnabled()) {
-                logger.warn(msg, t);
-            }
-        }
-
-        @Override
-        public boolean isErrorEnabled() {
-            return logger.isErrorEnabled();
-        }
-
-        @Override
-        public void error(String msg) {
-            if (isErrorEnabled()) {
-                logger.error(msg);
-            }
-        }
-
-        @Override
-        public void error(String format, Object arg) {
-            if (isErrorEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, arg);
-                logger.error(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void error(String format, Object argA, Object argB) {
-            if (isErrorEnabled()) {
-                FormattingTuple ft = MessageFormatter.format(format, argA, argB);
-                logger.error(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void error(String format, Object... arguments) {
-            if (isErrorEnabled()) {
-                FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
-                logger.error(ft.getMessage(), ft.getThrowable());
-            }
-        }
-
-        @Override
-        public void error(String msg, Throwable t) {
-            if (isErrorEnabled()) {
-                logger.error(msg, t);
-            }
-        }
-    }
-
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message