Thursday, December 18, 2008

"System.out" not being logged in Oracle Application Server 10g R3

A few projects ago, a developer complained that his System.out statements were not being logged. For example, his JSP might include the following line:
    System.out.println("hello world");
By default, this is not logged anywhere under Oracle Application Server 10g (10.1.3). The container must be manually configured to log these statements.

Configure System.out logging via EM Console:
1. Log in to the EM Console.
2. Navigate to the container name (e.g., home)
3. Click on Administration
4. Click on Server Properties
5. Add the following under Start-parameters: OC4J Options; for example:
-out c:\oracle\product\10.1.3\as10g\j2ee\home\log\ws_default_group_1\sysout.log
6. Restart the container

Configure System.out logging manually:
1. Shutdown opmn via opmnctl stopall
2. Edit the opmn.xml file and add the following entry to the start-parameters section of the container. For example:
<data id="oc4j-options" value="-out c:\oracle\product\10.1.3\as10g\j2ee\home\log\ws_default_group_1\sysout.log"/>
3. Restart opmn via opmnctl startall

The output should now appear in the log file you configured:
    %ORACLE_HOME%\j2ee\home\log\ws_default_group_1\sysout.log

No comments: