PilgrimOfNegentropy opened a new issue #3516:
URL: https://github.com/apache/rocketmq/issues/3516


   `org.apache.rocketmq.remoting.netty.NettyLogger#initNettyLogger` method sets 
the `InternalLoggerFactory#defaultFactory` to 
`org.apache.rocketmq.remoting.netty.NettyLogger.NettyBridgeLoggerFactory`  
overriding `io.netty.util.internal.logging.Slf4JLoggerFactory`
   
   `NettyBridgeLoggerFactory` produces loggers whose 
`isEnabled(InternalLogLevel internalLogLevel)` method is: 
   ```java
   return nettyLogLevel.ordinal() <= internalLogLevel.ordinal();
   ```
   it returns false when the argument `internalLogLevel` is not greaterEqual 
than `ERROR` because 
`org.apache.rocketmq.remoting.netty.NettyLogger#nettyLogLevel` is `ERROR` and 
it has no accessor so it's value is never changed
   
   - What did you do (The steps to reproduce)?
   
   `io.netty.handler.logging.LoggingHandler` uses `InternalLoggerFactory` to 
create loggers. Thus if it's initialized after the rocketmq client 
initialization, it creates a 
`org.apache.rocketmq.remoting.netty.NettyLogger.NettyBridgeLogger` instead of 
`SLF4J`'s. Thus it never prints logs under `ERROR` level.
   
   2. Please tell us about your environment:
   Windows 10 19043.1348
   Oracle jdk1.8.0_211
   maven dependency:
   ```
   <dependency>
               <groupId>org.apache.rocketmq</groupId>
               <artifactId>rocketmq-spring-boot-starter</artifactId>
               <version>2.1.1</version>
   </dependency>
   <dependency>
           <groupId>io.netty</groupId>
           <artifactId>netty-all</artifactId>
           <version>4.1.27.Final</version>
   </dependency>
   ```
   I inspected the `4.9.2` version of `rocketmq-client`, it's the same code.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to