geronimo-user mailing list archives

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

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. geronimo-web.ml in <environment>
add this:

<hidden-classes>
            <filter>org.apache.log4j</filter>
</hidden-classes>

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">
<log4j:configuration>
    <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" />
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="DEBUG" />
            <param name="LevelMax" value="INFO" />
        </filter>
    </appender>
    <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" />
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="WARN" />
            <param name="LevelMax" value="FATAL" />
        </filter>
    </appender>
<appender name="file"
        class="org.apache.log4j.DailyRollingFileAppender">
        <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" />
        </layout>
    </appender>

    <root>
        <level value="all" />
        <appender-ref ref="stdout" />
        <appender-ref ref="stderr" />
        <appender-ref ref="file" />
    </root>
</log4j:configuration>

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

${org.apache.geronimo.server.dir}/var/log/Log4jTest.log

It works perfect ;)

best regards
Łukasz

----- Original Message ----
From: Waldo Ramírez Montaño <waldo.ramirez@correo.unam.mx>
To: user@geronimo.apache.org
Sent: Monday, 3 September, 2007 8:14:09 PM
Subject: Logging in Geronimo 2.0.1


Hello,

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

Thanks again,
Waldo

-- 
View this message in context: http://www.nabble.com/Logging-in-Geronimo-2.0.1-tf4373488s134.html#a12465934
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.






      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html

Mime
View raw message