Thursday, December 31, 2009

Logging System.out statements

Problem:
Need to log System.out statements under Oracle Application Server 10g.

Thoughts:
For this requirement, I was searching on Internet and I got a solution which worked. Just thought of publishing this on this blog for readers.

This entry which give you an insight view about how to log system.out outputs on our SOA Servers. By default, this is not logged anywhere. For example, a Java code might include the following line:-
System.out.println("Test_123");

Solution:
You can configure this in two ways, either manually updating SOA Server files or via Enterprise Manager Console.

Configure System.out logging manually on SOA Server:
1) Stop the SOA Server
2) Navigate to <SOA_HOME>\opmn\conf
3) Open and edit opmn.xml file
4) Add the following entry to the start-parameters section of the container.
For example:
<data id="oc4j-options" value="-out d:\oracle\product\SOA\j2ee\<container_name>\log\Custom_log\systemout.log"/>
5) Restart SOA Server

Configure System.out logging via EM Console:
1) Log in to the EM Console
2) Click on proper container name
3) Click on Administration tab
4) Click on Server Properties link
5) Add the following under Start-parameters:- OC4J Options;
For example:
-out d:\oracle\product\SOA\j2ee\<container_name>\log\Custom_log\systemout.log
6. Restart the SOA Server

The output should now appear in the log file you configured:
<SOA_HOME>\j2ee\<container_name>\log\Custom_log\systemout.log

No comments: