On Thu, 5 Feb 2009 02:08:20 -0800 (PST)
 yankings <[email protected]> wrote:

Thank you for your reply.  I have tried to place the log4j.jar in the share
library of the oc4j instance, and then import this during application
deployment.  This would result the behavior i have mentioned at the my first
post message.

I don't know anything about OC4J, but if it allows for child-first (also called parent-last) classloading per application, then you can add log4j.jar to WEB-INF/lib and log4j.properties (or log4j.xml) to WEB-INF/classes.  This will result in each application having its own instance of Log4j and, therefore, enable both to auto-configure themselves with no clashes between applications.

Jake



Jacob Kjome wrote:

Whether the behavior is "strange" or not depends on how you are
configuring Log4j and how the classloader hierarchy is set up under OC4J... as well as where Log4j.jar exists in the classloader hierarchy.

I'm guessing you are letting Log4j auto-configure itself by finding your log4j.properties in the classpath.  If Log4j is in the OC4J classpath, I would only expect this to happen once, which would set up a single logger repository (the default one) which all applications would use.

Rather than speculate anymore about what could possibly be happening, I'll
let you describe you setup in greater detail.  We'll be able to draw more precise conclusions from that.


Jake


On Tue, 3 Feb 2009 23:36:51 -0800 (PST)
  yankings <[email protected]> wrote:

Hi,

I have deployed two applications into same OC4J instance, the version of
OC4J is 10.1.3.1.
The strange thing is the second applications will ignore it's oc4j
properties, and use the first applications log4j.propeties, here is the
log4j.properties in this two application:

log4j.properties in first application >>
log4j.rootLogger=info, MAIL, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d [%t] %5p (%F:%L) - %m%n

log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=/test/test.log
log4j.appender.R.DatePattern = '.'yyyy-MM-dd

log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender log4j.appender.MAIL.BufferSize=1 log4j.appender.Mail.Threshold =info
log4j.appender.MAIL.SMTPHost=smtphost.test.com
[email protected]
[email protected]
log4j.appender.MAIL.Subject=Testing Error Alert log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout log4j.appender.MAIL.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

log4j.properties in second application >>
log4j.rootLogger=info, MAIL, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d [%t] %5p (%F:%L) - %m%n

log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=/test/test2.log
log4j.appender.R.DatePattern = '.'yyyy-MM-dd

log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender log4j.appender.MAIL.BufferSize=1 log4j.appender.Mail.Threshold =info
log4j.appender.MAIL.SMTPHost=smtphost.test.com
[email protected]
[email protected]
log4j.appender.MAIL.Subject=Testing Error Alert log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout log4j.appender.MAIL.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n -- View this message in context: http://www.nabble.com/Strange-behaviour-of-log4j-tp21825741p21825741.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




--
View this message in context: http://www.nabble.com/Strange-behaviour-of-log4j-tp21825741p21848517.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to