log4j

L

lmestre

Hi,
I have a problem with log4j. I have several applications that use
log4j (different properties files).
The problem is that all of them writes in the same file which belongs
to the last application that started in the app server. Any Ideas?,

Thanks,
 
O

Oliver Wong

lmestre said:
Hi,
I have a problem with log4j. I have several applications that use
log4j (different properties files).
The problem is that all of them writes in the same file which belongs
to the last application that started in the app server. Any Ideas?,

Do these "several applications" have a single entry point?

- Oliver
 
L

Lasse Reichstein Nielsen

lmestre said:
Oliver Wong ha escrito: ....
No, they have a differet one (different ears)

Is log4j included in each ear file, or is it somehow installed
globally on the application server (perhaps as an extension for
the JVM)?
I.e., are all the applications using the same loaded class for
log4j?

/L
 
O

Oliver Wong

lmestre said:
the same class

Write filters and appenders so that each appender writes to a different
file and the filters give the appenders only the log events they are
interested in.

- Oliver
 
L

lmestre

Do i need to create my own class, for example
com.myorg.mypackage.MyClass
which extends for example org.apache.log4j.FileAppender? and the same
for the filter?
Is that correct?

Thanks,

Luz

Oliver Wong ha escrito:
 
O

Oliver Wong

lmestre said:
Do i need to create my own class, for example
com.myorg.mypackage.MyClass
which extends for example org.apache.log4j.FileAppender? and the same
for the filter?
Is that correct?

Yes, that is the basic strategy I proposed. However, note this passage
from the Javadocs:

http://logging.apache.org/log4j/docs/api/org/apache/log4j/spi/Filter.html
<quote>
Note that Category and AppenderSkeleton, the parent class of all standard
appenders, have built-in filtering rules. It is suggested that you first use
and understand the built-in rules before rushing to write your own custom
filters.
</quote>

- Oliver
 
L

lmestre

Thanks a lot!

Luz

Oliver Wong ha escrito:
Yes, that is the basic strategy I proposed. However, note this passage
from the Javadocs:

http://logging.apache.org/log4j/docs/api/org/apache/log4j/spi/Filter.html
<quote>
Note that Category and AppenderSkeleton, the parent class of all standard
appenders, have built-in filtering rules. It is suggested that you first use
and understand the built-in rules before rushing to write your own custom
filters.
</quote>

- Oliver
 
R

Raymond DeCampo

Lasse said:
Is log4j included in each ear file, or is it somehow installed
globally on the application server (perhaps as an extension for
the JVM)?
I.e., are all the applications using the same loaded class for
log4j?

/L

Have you tried placing a copy of log4j,jar and configuration files in
each EAR?

HTH,
Ray
 
L

lmestre

It didn't work. I did the proposed solution and i still have the
problem because every application extends the same appender :
FileAppender

:(

Luz
 
L

lmestre

Have you done that?
I think that is the right solution... but I need to put other jars too
and change the server policies of the class loader .

Luz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top