views:

116

answers:

1

I have written a wlst script to change the log file rotation strategy from BySize to ByTime which works correctly but the names of the rotated files are still fileName.log000n where n is a number.

I would like to have a datestamp in the rotated filenames instead. I didn't find any way to do this. Neither from the admin console nor with wlst.

Any suggestions ?

+2  A: 

It is possible to set the timestamp in the name of the file.

From http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13952/taskhelp/logging/RotateLogFiles.html

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

For example, if you enter the following value in the File Name field: myserver_%yyyy%%MM%%dd%%hh%%mm%.log, the server's log file will be named: myserver_yyyy_MM_dd_hh_mm.log.

When the server instance rotates the log file, the rotated file name contains the date stamp. For example, if the server instance rotates its local log file on 4 March, 2005 at 10:15 AM, the log file that contains the old log messages will be named: myserver_2005_03_04_10_15.log.

If you do not include a time and date stamp, the rotated log files are numbered in order of creation filenamennnnn, where filename is the name configured for the log file. For example: myserver.log00007

JoseK