(1)修改配置文件build\lib\dist\log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- add -->
<appender name="STDOUT">
<layout>
<param name="ConversionPattern"
value="%d [%24F:%-4L:%-5p][%x] -%m%n"/>
</layout>
</appender>
<!-- -->
<appender name="debug-out">
<param name="File" value="${openfireHome}/logs/debug.log" />
<param name="MaxFileSize" value="1024KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout>
<param name="ConversionPattern" value="%d{yyyy.MM.dd HH:mm:ss} %c - %m%n" />
</layout>
<filter>
<param name="LevelMax" value="debug" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="info-out">
<param name="File" value="${openfireHome}/logs/info.log" />
<param name="MaxFileSize" value="1024KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout>
<param name="ConversionPattern" value="%d{yyyy.MM.dd HH:mm:ss} %c - %m%n" />
</layout>
<filter>
<param name="LevelMax" value="info" />
<param name="LevelMin" value="info" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="warn-out">
<param name="File" value="${openfireHome}/logs/warn.log" />
<param name="MaxFileSize" value="1024KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout>
<param name="ConversionPattern" value="%d{yyyy.MM.dd HH:mm:ss} %c - %m%n" />
</layout>
<filter>
<param name="LevelMax" value="warn" />
<param name="LevelMin" value="warn" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<appender name="error-out">
<param name="File" value="${openfireHome}/logs/error.log" />
<param name="MaxFileSize" value="1024KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout>
<param name="ConversionPattern" value="%d{yyyy.MM.dd HH:mm:ss} %c - %m%n" />
</layout>
<filter>
<param name="LevelMin" value="error" />
<param name="AcceptOnMatch" value="true" />
</filter>
</appender>
<!-- add -->
<logger name="java.sql.Connection">
<level value="DEBUG" />
</logger>
<!-- -->
<root>
<level value="info" />
<!-- add -->
<appender-ref ref="STDOUT" />
<!-- -->
<appender-ref ref="debug-out" />
<appender-ref ref="info-out" />
<appender-ref ref="warn-out" />
<appender-ref ref="error-out" />
</root>
</log4j:configuration>
(2)编译openfire
ant openfire
(3)然后 Run Configuration 中 Classpath 增加 e:\openfire\build\lib\dist \
(4)重启openfire
备注:
openfire linux部署时注意的问题需要配置环境变量${openfireHome}
因为log4j.xml配置文件用到了,如下:
或者添加环境变量或修改配置文件路径为绝对路径即可以让日志输出到那期望的目录。