Sunday, August 21, 2011

Log file rotation

In the Managed Server configuration, Logging, "Log file name" you can assign a file name.
If you say

it will generate rotated filenames like


You can insert a timestamp information in the file name.


The documentation says:

"To include a time and date stamp in the file name when the log file is rotated, add java.text.SimpleDateFormat variables to the file name. Surround each variable with percentage (%) characters.

For example, if the file name is defined to be myserver_%yyyy%_%MM%_%dd%_%hh%_%mm%.log, the log file will be named myserver_yyyy_mm_dd_hh_mm.log.

When the log file is rotated, the rotated file name contains the date stamp. For example, if the log file is rotated for the first time on 2 April, 2003 at 10:05 AM, the log file that contains the old messages will be named myserver_2003_04_02_10_05.log00001."

If you do not include a time and date stamp, the rotated log files are numbered in order of creation. For example, myserver.log00007.

However this is slightly incorrect:

generates a rotated log file:

and not
as the documentation says.

Anyway the "Limit number of retained files" is respected, even is the progressive number is not the extension.

No comments: