2

私のjboss 6.1.0最終ASでは、30日間のログを保持したい..

jboss-logging.xml には、不要な size-rotating-file-handler があります.. ログ ファイルを毎日ローテーションする必要があります.. ログ設定を変更するにはどうすればよいですか

私のロギング設定は -

<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>

私を助けてください

4

2 に答える 2

2

毎日 1 つのファイルで 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>
于 2014-01-19T00:21:58.633 に答える
0

suffix パラメーターを理解するには、PeriodicRotatingFileHandler.javaのソースを見て不思議に思う必要があります。

setSuffix は suffix の文字を繰り返し処理し、それぞれに対して Period オブジェクトを作成し、最後のものが取得されます。したがって、suffix が m で終わる場合、Period.MINUTE が取得されます。

于 2016-06-17T08:51:09.633 に答える