java - How do I delete a log file while using RollingFileAppender in log4j? -
sometimes, while rolling log files, there seems issue occurring like: 'unable delete log file', 'unable move log file'.
error: java.nio.file.filesystemexception a.log -> directory\a-2011-08-09-2.log: process cannot access file because being used process.
following log4j configuration:
<rollingfile name="a" filename="${sys:catalina.base}/logs/a.log" append="true" createondemand="true" filepattern="${sys:catalina.base}/logs/a-%d{yyyy-mm-dd}-%i.log"> <patternlayout> <pattern>%d{iso8601}|%-5p|%i|%t|%s|%r|%t|%c{1} - %m%n</pattern> </patternlayout> <policies> <timebasedtriggeringpolicy /> <sizebasedtriggeringpolicy size="10mb"/> </policies> <defaultrolloverstrategy max="25"/> </rollingfile>
Comments
Post a Comment