私はlog4j2
を使ってウェブアプリケーションを持っています。ログは毎日作成する必要があります。log4j2 RollingFile AppenderはTomcatのファイル名を変更しませんか?
問題:古いファイルの内容が削除されません取得しますが、任意の新しい一日がちょうどそのファイルに追加されません。だからそれは絶え間なく成長する。 tomcat8
で実行している場合、一般的に次の構成が正しいですか?
log4j2.xml:
<Configuration>
<Appenders>
<RollingFile name="TEST" fileName="d:\test-application.txt" filePattern="d:\test-application-%d{yyyy-MM-dd}.log">
<Policies>
<TimeBasedTriggeringPolicy modulate="true"/>
</Policies>
//...
<RollingFile>
//...
</Appenders>
//...
</Configuration>
のMaven:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
私は、このように 'myfileを## 3.war'との戦争ファイルから更新されたバージョンをインストールし、TOMCATS'パラレルdeployment'を使用して、新しいが起動された後、以前のバージョンをアンデプロイしていたときには、ほとんど発生します。たぶん、動的にアンデプロイされたバージョンは、それでもログファイルをロックしますか?両方のアプリケーションが同じアプリケーションに書き込みます。 – membersound
並列デプロイメント時に別の設定(別のログファイル)を使用してテストできますか? –