开发者

How to disable SslFilter logging in apache MINA?

开发者 https://www.devze.com 2023-01-22 19:15 出处:网络
I\'am developing application based on apache MINA. For secure data transmission I use SSL. And there appears some annoying thing: when I rece开发者_开发问答ive incomming message, SslFilter class appen

I'am developing application based on apache MINA. For secure data transmission I use SSL. And there appears some annoying thing: when I rece开发者_开发问答ive incomming message, SslFilter class appends about 10kbytes to the log-file. How can I prevent this?


I finally found the solution for this problem. Here is the log4j.xml source:

<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
  <appender name="CONSOLE-DEBUG" class="org.apache.log4j.ConsoleAppender">
    <param name="target" value="System.out"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{ISO8601} [%5p] %m at %l%n"/>
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
      <param name="LevelMin" value="ALL"/>
      <param name="LevelMax" value="INFO"/>
    </filter>
  </appender>
  <appender name="CONSOLE-WARN" class="org.apache.log4j.ConsoleAppender">
    <param name="target" value="System.err"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{ISO8601} [%5p] %m at %l%n"/>
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
      <param name="LevelMin" value="WARN"/>
    </filter>
  </appender>
  <appender name="LOG-FILE-APPENDER" class="org.apache.log4j.FileAppender">
    <param name="file" value="app.log"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{ISO8601} [%5p] %c %m at %l%n"/>
    </layout>
  </appender>
  <category name="org.apache.mina.filter.ssl.SslHandler" additivity="false">
    <priority value="ERROR"/>
    <appender-ref ref="LOG-FILE-APPENDER"/>
  </category>
  <category name="org.apache.mina.filter.ssl.SslFilter" additivity="false">
    <priority value="ERROR"/>
    <appender-ref ref="LOG-FILE-APPENDER"/>
  </category>
  <root>
    <priority value="DEBUG"/>
    <appender-ref ref="CONSOLE-WARN"/>
    <appender-ref ref="CONSOLE-DEBUG"/>
    <appender-ref ref="LOG-FILE-APPENDER"/>
  </root>
</log4j:configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消