Friday, July 24, 2009

Add custom logfiles to 10.1.3 AS Control

Developers and testers have been asking us for the custom logfiles generated by the java application deployed on Oracle AS 10gR3. In AS Control you can watch and search the standard logfiles, but no options are available to view these extra logfiles.
Searching through metalink a teammember found a bug on 10.1.3 to fix some logfile viewing issues with AS control (metalink bug 5901925). This helped us to create the solution to our problem. The ascontrol application has two configuration files which controls which logfiles to process.

OC4J.xml - configuration for logfiles of Oracle Diagnostic logging feature
OPMN.xml - opmn logging configuration

These can be found in: $ORACLE_HOME/j2ee/home/applications/ascontrol/ascontrol/WEB-INF/config/registration

So now we would like to add the custom logfiles generated by applications and place them in the APPS viewpath in AS Control.

add the following to OC4J.xml

<log path="j2ee/%OC4J%/log/%OC4J_APP%.log" componentId="j2ee">
<logreader type="SimpleTextLog">
<property name="TimestampFormat" value="yy/MM/dd HH:mm:ss.SSS"/>
<property name="ModuleId" value="%OC4J%_%OC4J_APP%"/>
<property name="ComponentId" value="j2ee"/>
<logviewer LogType="OC4J_APPLICATION" ComponentName="%OC4J%"
<property name="COMPONENT_TYPE" value="APPS"/>
<property name="OC4J_APP" value="default"/>
<property name="displayPath"
<property name="category" value="application|diagnostic"/>

The trick is in the dynamic 'variables' which are enclosed in % symbols. These you can use to control the resulting view in AS Control. In this case the custom log should be generated with the name <application name>.log, where we use the %OC4J_APP% variable to dynamically pick up ALL custom logs of all applications in all the containers running on the Application server instance.

This way you can also add viewing of configuration files (in the logs section) of AS Control.

Btw: this is not documented and probably also not supported by Oracle :-) Applying patchsets probably overwrite your changes aswell, so beware.


No comments:

Post a Comment