The derby.stream.error.rollingFile.pattern property specifies the naming pattern to use for the rolling log files, if derby.stream.error.style is set to rollingFile.
If derby.stream.error.style is not set, this property setting is ignored.
You can override other rolling log file defaults by setting derby.stream.error.rollingFile.count or derby.stream.error.rollingFile.limit.
A pattern consists of a string that includes the following special components that will be replaced at runtime.
Pattern component | Description |
---|---|
/ | Local path name separator |
%t | The system temporary directory |
%h | The value of the user.home system property |
%d | The value of the derby.system.home system property |
%g | The generation number to distinguish rotated log files. Generation numbers follow the sequence 0, 1, 2, and so on. If you do not specify a %g field and the file count is greater than one, the generation number will be added to the end of the generated filename, after a dot. |
%u | A unique number to resolve conflicts. |
%% | Translates to a single percent sign (%) |
Thus, for example, a derby.stream.error.rollingFile.pattern setting of %t/java%g.log with a derby.stream.error.rollingFile.count setting of 2 might cause log files on a UNIX system to be written to /var/tmp/java0.log and /var/tmp/java1.log, whereas on a Windows 7 system they might be written to %USERPROFILE%\AppData\Local\Temp\java0.log and %USERPROFILE%\AppData\Local\Temp\java1.log.
Normally, the %u unique field is set to 0 (zero). However, if Derby tries to open the file by the specified name and finds that the file is currently in use by another process, it will increment the unique number field and try again. This action will be repeated until Derby finds a file name that is not currently in use. If there is a conflict and no %u field has been specified, the unique number will be added at the end of the filename after a dot. (This will be after any automatically added generation number.)
For example, if three processes are all trying to log to fred%u.%g.txt, they might have log files named fred0.0.txt, fred1.0.txt, fred2.0.txt as the first file in their rotating sequences.
derby.stream.error.rollingFile.pattern=pattern
The number of characters in the specified pattern value must be equal to or greater than 1.
%d/derby-%g.log.
The following setting creates files named myDBlog-0.txt, myDBlog-1.txt, and so on, in the user's home directory:
derby.stream.error.rollingFile.pattern=%h/myDBlog-%g.txt
This property is static; if you change it while Derby is running, the change does not take effect until you reboot.