I would recommend looking at the Log4j unit tests and using the 
LoggerContextRule with the withCleanFoldersRule like RollingAppenderCronTest 
does or the withCleanFilesRule like RoutingAppenderTest does. The key is that 
these delete the files after Log4j has shut down so the file handles are closed.

Ralph

> On Jan 31, 2017, at 11:17 AM, Clément Guillaume <cguilla...@hotpads.com> 
> wrote:
> 
> Hi,
> 
> I have a unit test, using log4j 2.8 to log to a file using a FileAppender,
> that deletes the log file at the end of the test. This test works well on
> linux, but fails on Windows because the java process still has a file
> handle to the log file, and so the file cannot be deleted.
> Any idea how to have the same behavior on the two platforms?
> 
> Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to