This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 903db35  Merge pull request #1717, NettyHelper in netty extension 
populated Logger "InternalLogger" in netty.
903db35 is described below

commit 903db35c605709806ef6a91831e5ea2a26a2e8a1
Author: Ian Luo <ian....@gmail.com>
AuthorDate: Thu May 3 15:07:34 2018 +0800

    Merge pull request #1717, NettyHelper in netty extension populated Logger 
"InternalLogger" in netty.
---
 .../remoting/transport/netty4/NettyClient.java     |   2 -
 .../remoting/transport/netty4/NettyServer.java     |   3 -
 .../transport/netty4/logging/NettyHelper.java      | 268 ---------------------
 3 files changed, 273 deletions(-)

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 73c54b7..ea273ae 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.common.utils.NetUtils;
 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 class NettyClient extends AbstractClient {
 
     @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 1924bd1..c4ffcf5 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.RemotingException;
 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 class NettyServer extends AbstractServer implements 
Server {
 
     @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 715aa64..0000000
--- 
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);
-            }
-        }
-    }
-
-}

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.

Reply via email to