无法在Wildfly 10.1.0上旋转日志文件

时间:2017-11-01 11:49:50

标签: logging jboss log4j wildfly wildfly-10

我想每小时轮换一次日志文件,这样就可以在一天和第二天24创建24个文件,依此类推 所以我创建了一个自定义处理程序,如下所示

<custom-handler name="filehandler" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">
    <formatter>
        <named-formatter name="PATTERN"/>
    </formatter>
    <properties>
        <property name="maxBackupIndex" value="24"/>
        <property name="rotateSize" value="10000"/>
        <property name="suffix" value=".yyyy-MM-dd-HH"/>
        <property name="append" value="true"/>
        <property name="fileName" value="${jboss.server.log.dir}/server.log"/>
    </properties>
</custom-handler>

但它给了我以下错误。我正在使用Windows 64位。 在Wildfly 10.1.0中,它有jboss-logmanager-2.0.4.Final.jar,在某些论坛中,我读到将jar降级为jboss-logmanager-2.0.3.Final.jar,但在降级后它一直写入同一个日志文件。

[Server:server-one] LogManager error of type OPEN_FAILURE: Unable to rotate log file
[Server:server-one] java.nio.file.FileSystemException: D:\wildfly10_slave1\domain\servers\server-one\log\server.log -> D:\wildfly10_slave1\domain\servers\server-one\log\server.log
The process cannot access the file because it is being used by another process.
[Server:server-one]
[Server:server-one]     at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
[Server:server-one]     at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
[Server:server-one]     at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
[Server:server-one]     at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
[Server:server-one]     at java.nio.file.Files.move(Unknown Source)
[Server:server-one]     at org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler.rotate(PeriodicSizeRotatingFileHandler.java:251)
[Server:server-one]     at org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler.preWrite(PeriodicSizeRotatingFileHandler.java:232)
[Server:server-one]     at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:60)
[Server:server-one]     at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:76)
[Server:server-one]     at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:314)
[Server:server-one] 16:49:57,739 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.2.Final
[Server:server-one]     at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:322)
[Server:server-one]     at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:322)
[Server:server-one]     at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:322)
[Server:server-one]     at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
[Server:server-one]     at org.jboss.logmanager.Logger.logRaw(Logger.java:860)
[Server:server-one]     at org.jboss.logmanager.Logger.log(Logger.java:393)
[Server:server-one]     at org.jboss.modules.log.JDKModuleLogger.doLog(JDKModuleLogger.java:105)
[Server:server-one]     at org.jboss.modules.log.JDKModuleLogger.doLog(JDKModuleLogger.java:97)
[Server:server-one]     at org.jboss.modules.log.JDKModuleLogger.greeting(JDKModuleLogger.java:178)
[Server:server-one]     at org.jboss.modules.Module.setModuleLogger(Module.java:970)
[Server:server-one]     at org.jboss.modules.Main.main(Main.java:483)

更新:

JIRA已经报道了一个问题 https://issues.jboss.org/browse/LOGMGR-154 我尝试使用最新的jboss-log管理器,但它没有用,而且2.0.8-Final jar也不存在

0 个答案:

没有答案