Monday, March 11, 2013

Configure logging from java code in OIM 11g



Configure logging from java code in OIM 11g , we need to do  the following :
1.       Modify logging.xml
Location of logging.xml : /iam/ml_home/user_projects/domains/base_domain/config/fmwconfig/servers/oim_server1
Open logging.xml.

a.       Add the following section inside       <log_handlers>              </log_handlers>

<log_handler name='My-Test-handler' level='FINEST' class='oracle.core.ojdl.logging.ODLHandlerFactory'>
<property name='logreader:' value='off'/>
<property name='path' value='/iam/ml_home/logs/MyTestLog.log'/>
<property name='format' value='ODL-Text'/>
<property name='useThreadName' value='true'/>
<property name='locale' value='en'/>
<property name='maxFileSize' value='5242880'/>
<property name='maxLogSize' value='52428800'/>
<property name='encoding' value='UTF-8'/>
</log_handler>

b.      Add the following section inside       <loggers>              </loggers>

<logger name="MyTestLogger" level="TRACE:32" useParentHandlers="false">
  <handler name="My-Test-handler"/>
  <handler name="console-handler"/>
  </logger>


2.       Write any java code for OIM
Add the following syntax.
import oracle.core.ojdl.logging.ODLLogger;

public class TestClass {
      ODLLogger logger = ODLLogger.getODLLogger("MyTestLogger");

protected void testMethod(String resourceObject) {
           
                  logger.info("its my test log message");

      }

}

No comments:

Post a Comment