geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xh <>
Subject Re: Logging in Geronimo 2.0.1
Date Wed, 05 Sep 2007 09:08:00 GMT

You can use Your own Log4j configuration in your applications (to tell the truth I've only
used it in WAR).

Below is my configuration that works with WAS-CE (based on Geronimo 1.1).
It should also work on G2.0.1 (I have G2.0.1, but I haven't migrated the project, yet).

Place Your own log4j.xml and log4j.dtd in e.g. WEB-INF/classes directory (it must be on the
class path). Add log4j librarry to Your project WEB-INF/lib.

To load new instance of Log4J Logger and all other classes, You need to inform Geronimo that
You want Your own classes to be loaded, in deployment file e.g. in <environment>
add this:


Geronimo will load Your classes from org.apache.log4j package (including sub-packages).

My log4j.xml looks sth like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="[%d{ISO8601}] %-5p %l %m %n" />
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="DEBUG" />
            <param name="LevelMax" value="INFO" />
    <appender name="stderr" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.err" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="[%d{ISO8601}] %-5p %l %m %n" />
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="WARN" />
            <param name="LevelMax" value="FATAL" />
<appender name="file"
        <param name="threshold" value="info" />
        <param name="File"
            value="${org.apache.geronimo.server.dir}/var/log/Log4jTest.log" />
        <param name="DatePattern" value="'.'yyyy-MM-dd" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="[%d{ISO8601}] Session Id %x%n%-5p %l %m%n" />

        <level value="all" />
        <appender-ref ref="stdout" />
        <appender-ref ref="stderr" />
        <appender-ref ref="file" />

And now all logs of Your application will be logged into:


It works perfect ;)

best regards

----- Original Message ----
From: Waldo Ramírez Montaño <>
Sent: Monday, 3 September, 2007 8:14:09 PM
Subject: Logging in Geronimo 2.0.1


Is it possible that deployments (EJB's, WAR's, EAR's) have their own
log-files in Geronimo 2.0.1?

Thanks again,

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

Want ideas for reducing your carbon footprint? Visit Yahoo! For Good

View raw message