4. Log4J
Prev | Chapter 3. Logging and Auditing | Next

## 4. Log4J

When `openjpa.Log` is set to `log4j`, OpenJPA will delegate to Log4J for logging. In a standalone application, Log4J logging levels are controlled by a resource named `log4j.properties` , which should be available as a top-level resource (either at the top level of a jar file, or in the root of one of the `CLASSPATH` directories). When deploying to a web or EJB application server, Log4J configuration is often performed in a `log4j.xml` file instead of a properties file. For further details on configuring Log4J, please see the Log4J Manual. We present an example `log4j.properties` file below.

Example 3.4. Standard Log4J Logging

    log4j.rootCategory=WARN, console
    log4j.category.openjpa.Tool=INFO
    log4j.category.openjpa.Runtime=INFO
    log4j.category.openjpa.Remote=WARN
    log4j.category.openjpa.DataCache=WARN
    log4j.category.openjpa.MetaData=WARN
    log4j.category.openjpa.Enhance=WARN
    log4j.category.openjpa.Query=WARN
    log4j.category.openjpa.jdbc.SQL=WARN
    log4j.category.openjpa.jdbc.SQLDiag=WARN
    log4j.category.openjpa.jdbc.JDBC=WARN
    log4j.category.openjpa.jdbc.Schema=WARN

    log4j.appender.console=org.apache.log4j.ConsoleAppender

Prev | Up | Next
3. Disabling Logging | Home | 5. Apache Commons Logging