首页 > 解决方案 > JBOSS 6.3 访问日志自动删除

问题描述

我正在 JBOSS EAP 6.3 中寻找自动删除访问日志的解决方案。我添加了以下配置以将访问日志打印在不同的文件中,但它没有任何参数可以在特定时间间隔后删除文件。

<access-log pattern="%h %l %u %t %r %s %b %S %T" prefix="access_log_" rotate="true">
    <directory path="." />
</access-log>

标签: jbossjboss6.xjboss-eap-6

解决方案


In standalone.xml , you can have log handler configuration based on the size.

  <size-rotating-file-handler name="FILE" autoflush="true">
                <formatter>
                    <named-formatter name="PATTERN"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <rotate-size value="1M"/>
                <max-backup-index value="1"/>
                <append value="true"/>
            </size-rotating-file-handler>

推荐阅读