Search code examples
javaloggingjakarta-eelog4joc4j

Using log4j in oc4j 10.1.3


I have a web application running on OC4J 10.1.3. I am trying to do some logging using log4j. The messages show up in my IDE console as expected, but nothing is going into the application.log in OC4J. Anybody know what I need to do to get this working?

Here's my log4j.properties:

log4j.rootCategory=DEBUG, CON1

# CON1 is set to be ConsoleAppender sending its output to System.out
log4j.appender.CON1=org.apache.log4j.ConsoleAppender
log4j.appender.CON1.layout=org.apache.log4j.PatternLayout
log4j.appender.CON1.layout.ConversionPattern=%p: [%l] - %m%n

log4j.logger.org.apache.ojb.broker.accesslayer=DEBUG

And in my java classes I'm doing this:

Logger logger = Logger.getLogger(getClass().getName());
logger.debug("Test message.");

Solution

  • Configure OC4J to log the console output to a file.
    If you are using the full IAS add this to the opmn.xml

    <data id="oc4j-options" value="-verbosity 10 -err err.log -out out.log"/>
    

    If you are using the stanalone OC4j:

      java -jar oc4j.jar -err err.log -out out.log