When you construct your fileHandler
object, modify filePath
to use a pattern. Create a pattern that makes use of the %g
component. This component will be replaced at runtime with the generation number to distinguish rotated logs.
Example
To place log file in the system temp directory with form %TEMP%/mylog.1.log
, use the following pattern:
`"%t/mylog.%g.log"`