Как повернуть файл журнала в jboss 6 AS
В моем выпуске jboss 6.1.0 AS я хочу вести журнал за 30 дней.
в jboss-logging.xml есть обработчик размера вращающегося файла, который мне не нужен.. мне нужно каждый день вращать файл журнала.. как можно изменить конфигурацию журнала
моя конфигурация регистрации -
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/server.log"
name="FILE"
autoflush="true"
append="true"
suffix="..yyyy-MM-dd"> <!-- To roll over at the top of each hour, use ".yyyy-MM-dd-HH" instead -->
<error-manager>
<only-once/>
</error-manager>
<formatter>
<!-- To revert back to simple stack traces without JAR versions, change "%E" to "%e" below. -->
<!-- Uncomment this to get the class name in the log as well as the category
<pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
-->
<!-- Uncomment this to log without the class name in the log -->
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
Помогите мне, пожалуйста
2 ответа
Чтобы хранить 30 дней журналов с одним файлом на каждый день, попробуйте следующее...
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/server.log"
name="FILE"
autoflush="true"
append="true"
suffix=".dd"> <!-- To roll over at the top of each hour, use ".yyyy-MM-dd-HH" instead -->
<error-manager>
<only-once/>
</error-manager>
<formatter>
<!-- To revert back to simple stack traces without JAR versions, change "%E" to "%e" below. -->
<!-- Uncomment this to get the class name in the log as well as the category
<pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
-->
<!-- Uncomment this to log without the class name in the log -->
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%e%n"/>
</formatter>
</periodic-rotating-file-handler>
Чтобы понять параметр суффикса, вы должны взглянуть на источник PeriodicRotatingFileHandler.java и удивиться.
setSuffix перебирает символы суффикса, создает объект Period для каждого и берется последний. Таким образом, если суффикс заканчивается на m, берется Period.MINUTE.