geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <xhh...@gmail.com>
Subject Re: Problems using log4j Gbean
Date Thu, 09 Apr 2009 04:57:13 GMT
Another way without chaning anything is,
1. Put  something like below in your deployment plan
   <dep:dependencies>
            <dep:dependency>
                <dep:groupId>log4j</dep:groupId>
                <dep:artifactId>log4j</dep:artifactId>
                <dep:type>jar</dep:type>
            </dep:dependency>
            <dep:dependency>
                <dep:groupId>org.slf4j</dep:groupId>
                <dep:artifactId>slf4j-api</dep:artifactId>
                <dep:type>jar</dep:type>
            </dep:dependency>
            <dep:dependency>
                <dep:groupId>org.slf4j</dep:groupId>
                <dep:artifactId>slf4j-log4j12</dep:artifactId>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
        <dep:hidden-classes>
            <dep:filter>org.apache.log4j</dep:filter>
            <dep:filter>org.slf4j</dep:filter>
        </dep:hidden-classes>
2. Do NOT use the ApplicationLog4jConfigurationGBean gbean, just put a
log4j.properties in your application's classpath, let log4j itself to manage
the configurations.

It should work as expected.
     Ivan


2009/4/9 Ivan <xhhsld@gmail.com>

> Yes, it needs to be improved.
> I opened a JIRA in https://issues.apache.org/jira/browse/GERONIMO-4615.
> If you could like to, you could apply the patch to the code repo which is
> used. Build the geronimo-system module, and paste it to the lib folder and
> repository folder.
> Also, you need to add something to your deployment plan. Then ...
> Thanks !
>                Ivan
>
>
> 2009/4/8 Jochen Zink <jochenlist@web.de>
>
> The util part, has the same package name, because the classes are located
>> inside a util.jar, which is used by both applications and placed in
>> WEB-INF/lib of both applications. The Applications itself have different
>> package names.
>>
>> But it is also imaginable, that the applications have the same package
>> names. Application A can deployed twice, if the module ID and context-root
>> in geronimo-web.xml is different. It would be nice feature, if it is
>> possible to log in different Logfiles, in this situation.
>>
>> Regards
>> Jochen
>>
>> > -----Ursprüngliche Nachricht-----
>> > Von: "Ivan" <xhhsld@gmail.com>
>> > Gesendet: 07.04.09 16:01:48
>> > An: user@geronimo.apache.org
>> > Betreff: Re: Problems using log4j Gbean
>>
>> Are the application A has the same package names with the package B ?
>> > I mean
>> > In the properties File for application A :
>> > log4j.logger.de.test.webapp.util=DEBUG,fileA
>> >
>> > In the properties File for application B :
>> > log4j.logger.de.test.webappB.util=DEBUG,fileB
>> >
>> > IIRC, they should not the same, for Log4j share a global configuration.
>> >
>> >  Ivan
>> >
>> > 2009/4/7 Jochen Zink <jochenlist@web.de>
>> > Hello,
>> >
>> > we use geronimo 2.1.1. For Logging, we use Log4j and the log4j Plugin.
>> >
>> > We have two Webapplications (WebApp A and WebApp B) running. Both use
>> > a "util.jar".
>> >
>> > If we deployApplication A before application B, Application A logs
>> > into Application Bs logfile. If we deploy first application B,
>> > application B logs into application As logfile.
>> >
>> > I guess, this is related to the equal package name from util.jar.
>> >
>> > Is there a possibility to avoid this?
>> >
>> > Here is geronimo-web.xml (plugin part) for application A. Application
>> > Bs is equal. Only the properties name is different.
>> > <gbean name="DirectoryLog4jConfiguration" class="org.apache.geronimo.
>> > system.logging.log4j.ApplicationLog4jConfigurationGBean">
>> >  <attribute name="log4jFile">var/log/applicationA.properties</
>> > attribute>
>> >  <reference name="ServerInfo">
>> >  <name>ServerInfo</name>
>> >  </reference>
>> >  </gbean>
>> >
>> > And here is the content of the log4j properties File for application
>> > A. This is equal to application Bs properties. Only fileA changed to
>> > fileB and so on.
>> >
>> > log4j.appender.fileA=org.apache.log4j.DailyRollingFileAppender
>> > log4j.appender.fileA.threshold=DEBUG
>> > log4j.appender.fileA.file=${org.apache.geronimo.server.dir}/var/log/
>> > appA.log
>> > log4j.appender.fileA.layout=org.apache.log4j.PatternLayout
>> > log4j.appender.fileA.layout.ConversionPattern=Application A: %d{dd.MM.
>> > yyyy, HH:mm:ss} %p (%c:%L) %m%n
>> >
>> > log4j.logger.de.test.webapp.util=DEBUG,fileA
>> > log4j.logger.de.test.webapplicationA=DEBUG,fileA
>> > log4j.additivity.de.webapp.util=false
>> > log4j.additivity.de.webapplicationA=false
>> >
>> > Thanks a lot!
>> > Regards
>> > Jochen
>> >
>> > ____________________________________________________________________
>> > Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
>> > Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123
>> >
>> > --
>> > Ivan
>> >
>> >
>>
>>
>> ____________________________________________________________________
>> Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
>> Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123
>>
>>
>
>
> --
> Ivan
>



-- 
Ivan

Mime
View raw message