Jira サーバーのログ ファイルのローテーション サイズを変更する
目的
jira-home ディレクトリ内にある atlassian-jira.log などのファイルは、デフォルトで 20 MB になると自動的にローテーションされます。より多くの情報を取得したいときに、このサイズを増やす必要がある場合があります。
ソリューション
Jira 9.5 and below:
JIRA-INSTALL/atlassian-jira/WEB-INF/classes/log4j.properties にあるファイルを確認すると、次のようになっています。
log4j.appender.xxxxxxxxlog=com.atlassian.jira.logging.JiraHomeAppender
log4j.appender.xxxxxxxxlog.File=atlassian-jira.log
log4j.appender.xxxxxxxxlog.MaxFileSize=20480KB
log4j.appender.xxxxxxxxlog.MaxBackupIndex=5
log4j.appender.xxxxxxxxlog.layout=com.atlassian.logging.log4j.NewLineIndentingFilteringPatternLayout
log4j.appender.xxxxxxxxlog.layout.ConversionPattern=%d %t %p %X{jira.username} %X{jira.request.id} %X{jira.request.assession.id} %X{jira.request.ipaddr} %X{jira.request.url} [%q{2}] %m%n
Jira でログ ファイルを切り替えるサイズを増減するには、log4j.appender.xxxxxxxxlog.MaxFileSize=20480KB を変更します。
変更を有効化するために Jira を再起動します。
各ログ ファイルは独自のセクションを持つため、パラメーターは注意深く変更してください。
Jira 9.5 and above:
Please notice that as of Jira 9.5, log4j runtime library was upgraded to version 2.0:
https://confluence.atlassian.com/adminjiraserver/logging-and-profiling-938847671.html
The main change here is that instead of modifying log4j.properties, log4j2.xml file is now the new configuration file that needs to be modified. It resides under the same JIRA-INSTALL/atlassian-jira/WEB-INF/classes/ folder.
For the above quoted example, in order to change the log file size on Jira 9.5 and above, SizeBasedTriggeringPolicy value will need to be changed, on a per 'Appender' basis.
For example, to change atlassian-jira.log max size from the default 20Mb to 80Mb, locate the following section under log:
<JiraHomeAppender name="filelog"
fileName="atlassian-jira.log"
filePattern="atlassian-jira.log.%i">
<PatternLayout alwaysWriteExceptions="false">
<Pattern>${StackTraceFilteringPattern}</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="20480 KB"/>
</Policies>
<DefaultRolloverStrategy fileIndex="min" max="10"/>
</JiraHomeAppender>
Once located, change the "20480 KB" to "81920 KB", restart the application and the new setting should take affect.