You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Jochen Zink <jo...@web.de> on 2009/04/07 15:16:42 UTC

Problems using log4j Gbean

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


Re: Problems using log4j Gbean

Posted by Ivan <xh...@gmail.com>.
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 <jo...@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