NAVIGATION
Home
Gallery
Java
Linux
Web
Scripts And Utilities
Mobile And Sms
Misc
Contact
pixelWIKI
Nabaz Tag




<<

Oracle Application Server

It has been my misfortune to do some development recently for Oracle Application Server and Oracle Portal, and so I want to share some of my pain and prevent others suffering as I did.

logging


Logging
This is the thing that caused the most pain of all with OAS. Most other issues were merely a PITA in comparison.

At one point, I managed to get log4j working, successfully logging to ${oracle.j2ee.home}/logs/ but then this stopped for no apparent reason, and would not even log to /tmp/oracle.log

After much googling and (fruitless) searching of the Oracle documentation, we managed to get the native java logging working, after a fashion. This was good, except that it logged to an xml file, with lots of irrelevant information, and little useful information.

A Service Request later, and I was now using oracle.portal.log.LogManager, which happily logs to the application.log of your deployed ear. This, combined with some more documentation searching and googling, led me to the following log levels, set in the web.xml of your war:


<context-param>
<param-name>oracle.portal.log.LogLevel</param-name>
<param-value>8</param-value>
</context-param>
<!--
8 = debug
7 = info
4 = warning
-->


This can also be overridden through the Application Server Control site, by choosing the Portal, your Application, the web module and Environment Administration.

I created this helper class to make life easier, too.


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
package net.pixelseventy2.oracle.portal.logging;

import oracle.portal.log.LogManager;

public class Log {

	public static void info( Object _clazz, String _msg ) {
		LogManager.info( "INFO: " + getName(_clazz) + _msg );
	}
	
	public static void warn( Object _clazz, String _msg ) {
		LogManager.warning( getName(_clazz) + _msg );
	}
	
	public static void error( Object _clazz, String _msg ) {
		LogManager.severe( getName(_clazz) + _msg );
	}
	
	public static void error( Object _clazz, String _msg, Exception _e ) {
		LogManager.severe( getName(_clazz) + _msg, _e );
	}
	
	public static void debug( Object _clazz, String _msg ) {		
		LogManager.debug( "DEBUG:" + getName(_clazz) + _msg );
	}
	
	private static String getName( Object _obj ){
		Class clazz;
		if (  _obj instanceof Class ) {
			clazz = (Class) _obj;
		} else {
			clazz = _obj.getClass();			
		}
		return "[" + clazz.getName() + "] ";
	}
	
}



I'm sure this is all very obvious to someone who knows OAS and Portal, but to someone who primarily uses JBoss and log4j, this is all very irritating, and I hope this page can save someone a lot of time and effort. Please let me know if this helps you, or even if you know how to do this properly.