Log4j XML Configuration

Note to self – don’t forget this!

For some reason, I can’t seem to retain a key piece of information – how to configure the logging level per-package in the log4j XML configuration. I’m putting this snippet here to cater for the likely event that I’ll forget it again. It’s all to do with the category element, as it happens.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="">

  <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.SimpleLayout"/>

  <category name="org.apache">
        <priority value="warn"/>

    <priority value="debug" />
    <appender-ref ref="ConsoleAppender"/>


Leave a Reply