- Copy log4j-1.2.15.jar to <oss_home>/soa/modules/oracle.soa.ext_11.1.1 and execute ANT script in this directory. This will recreate the oracle.soa.ext.jar file adding the log4j lib to the classpath.
- Create a new folder for Log4j configuration and log files: <middleware_home>/config, for example
- add to this folder the configuration files (log4j.debug.xml and log4j.dtd, for example)
- set the log file name and path (<middleware_home>/config/customErrorLog.log, for example) in the log4j.debug.xml
- Change the startManagedServer script to point to Log4j configuration file: JAVA_OPTIONS="-Dlog4j.configuration=file:<middleware_home>/config/log4j.debug.xml”
- Restart the SOA managed server.
- Import the log4j-1.2.15.jar to the project libs (right click in the project name and select “Project Properties”, go to “Libraries and Classpath” and add the jar file)
- Insert a Java Embedding activity
- In the BPEL source code, import the Logger class adding the code below before the “bpelx:exec” created for the Java Embedding component
<bpelx:exec import="org.apache.log4j.Logger">
Logger logger = Logger.getLogger("myCustomLog");
logger.info(">>>> Message log for instance: " + getTitle());To download the Log4j configuration files together with a Composite with a sample use of the log, click here.