You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何停止NioProcessor的日志记录?

How to Stop NioProcessor Logs from Apache MINA's LoggingFilter

Got it, those repetitive NioProcessor logs from MINA's LoggingFilter can be super annoying. Let's fix that right away!

First, let's clarify: those logs are coming from org.apache.mina.filter.logging.LoggingFilter, which defaults to logging connection lifecycle events (like CREATED, OPENED, CLOSED) at the INFO level. To mute these, you just need to adjust the logging level for this specific class in your logging framework configuration.

Here are the most common solutions based on the logging framework you're using:

1. If you're using Logback (Spring Boot's default)

Option 1: Update logback.xml or logback-spring.xml

Add a logger configuration specifically for the LoggingFilter class to raise its log level (so INFO messages get ignored):

<configuration>
    <!-- ... your existing config ... -->
    <logger name="org.apache.mina.filter.logging.LoggingFilter" level="WARN" additivity="false">
        <appender-ref ref="YOUR_APPENDER_NAME"/>
    </logger>
</configuration>

Setting the level to WARN will only let through warning and error messages. If you want to silence it completely, use OFF instead.

Option 2: Use Spring Boot's application properties

If you're using Spring Boot, you can add this line directly to application.properties:

logging.level.org.apache.mina.filter.logging.LoggingFilter=WARN

Or in application.yml:

logging:
  level:
    org.apache.mina.filter.logging.LoggingFilter: WARN

2. If you're using Log4j2

Update your log4j2.xml to include a logger for the LoggingFilter:

<Configuration>
    <!-- ... your existing config ... -->
    <Logger name="org.apache.mina.filter.logging.LoggingFilter" level="WARN" additivity="false">
        <AppenderRef ref="YOUR_APPENDER_NAME"/>
    </Logger>
</Configuration>

Again, use OFF if you want to stop all logs from this class entirely.

If you need a quick code-based fix (though configuration files are better for maintainability), you can set the log level programmatically:

import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Logger;

// For Logback
Logger logger = (Logger) LoggerFactory.getLogger("org.apache.mina.filter.logging.LoggingFilter");
logger.setLevel(ch.qos.logback.classic.Level.WARN);

That should get rid of those pesky NioProcessor connection status logs.

内容的提问来源于stack exchange,提问作者cathy Chou

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 06:49:22