22.2.06

OC4J (9.0.4, 10.1.2 and 10.1.3) log file rotation

For those that want to rotate the OC4J log files under $ORACLE_HOME/opmn/logs, there are new parameters not documented in 9.0.4/10.1.2 documentation:

[New JVM parameters]
"stdstream.filesize"
Max file size limit of each archive. Unit is megabyte.
"stdstream.filenumber"
Max number of files that oc4j can keep as archives. The oldest file
will be automatically deleted if the limit is exceeded.
"stdstream.rotatetime"
Time when the log file is rotated. Format is "HH:mm". The archive
will be rotated at the specified time everyday.

[Usage]
ex 1: rotate stdout/stderr when the file size is reached to 2.5M byte.
java -Dstdstream.filesize=2.5 -jar oc4j.jar -out std.out -err std.err
ex 2: rotate stdout at 13:30 everyday
java -Dstdstream.rotatetime=13:30 -jar oc4j.jar -out std.out
ex 3: rotate stdout at 13:30 everyday and keep 10 files as archive
java -Dstdstream.rotatetime=13:30 -Dstdstream.filenumber=10 -jar oc4j.jar -out std.out

The generated log file would look like <filename w/o extension>_yyyy_MM_dd_HH_mm_ss.<extension>
e.g. std_2004_07_08_13_24_53.out

[Note]
1. The same parameter are used for both "-out" and "-err".
2. In AS mode, the log files will be created under <island name and process id> directory
(this isn't changed by this fix, existing code handles this)
3. Both "filesize" and "rotatetime" parameters can be used at the same time.

opmn.xml
In order to get these parameters in opmn.xml you need to define it as follows:
...
<category id="start-parameters">
<data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Dstdstream.filesize=0.2 -Dstdstream.filenumber=5"/>
<data id="oc4j-options" value="-out std.out -err std.err"/>
</category>
...

You will find the new log files under:$ORACLE_HOME/j2ee/home/home_default_island_1

The file naming will be like:
std_2006_02_22_14_01_17.out
std_2006_02_22_14_16_25.out