log4j

Hi Friends
can anyone of you please advice if websphere uses any default log4j configuration file for appenders like jboss has log4j.xml .it is urgent...

Thanks..
dmoreAsked:
Who is Participating?
 
avinthmCommented:
i dont think application servers provide you the default configuration log4j.xml.

its the log4j framework which provides you the xml.
if u r using log4j for logging then u will have to come up with your own configuration file and name it as log4j.xml

you will get lot of guideance here
http://logging.apache.org/log4j/docs/
http://www.jguru.com/faq/Log4j
http://en.wikipedia.org/wiki/Log4j

cheers
0
 
dmoreAuthor Commented:
Hi avinthm
JBOSS provides us with its own log4j.xml so wanted to know if websphere has something similar.Do you mean to say that websphere app server does' nt provide one
0
 
avinthmCommented:
I am not sure about JBoss. But atleast Websphere doesnt provide anything like that (i mean log4j.xml)

When u develop your application, you will have to come up with ur configuration.
Package the whole application , including config xml files etc etc, into an war or ear.
Then deploy it in WAS (websphere app server).

This is the way u got to work on WAS.
0
 
sleep_furiouslyCommented:
Out of the box, depending on your version of Websphere, it uses java.util.logging (J2SE standard JSR 47) through a Jakarta Commons-Logging wrapper, or (now deprecated) JRas.

You can switch the Commons-Logging wrapper to use log4j instead of java.util.logging (set in commons-logging.properties), but you might need to add the log4j jar file and config file yourself.  There can be special issues for clustered servers or for particular operating systems (z/OS, i5/OS).

There are also different options for using the commons-logging provided by WAS, bundling it with your application, or bundling it with your application configuration.

If you are familiar with log4j, note that java.util.logging uses similar concepts with different names

log4j  --> java.util.logging
--------------------------------
appender --> handler
layout  -->  fomatter
LoggingEvent --> LogRecord

So a few questions:  What version of Websphere?  On what platform?  What are you trying to accomplish?
0
 
dmoreAuthor Commented:
friends,
Thanks for your advice.Iam now facing a different issue.I have have servlet which starts up automatically when websphere starts.it calls another EJB in which I have put some logger.info and logger.debug statements.The EJB does it functionality but does not write these statments to the log.Obviously it looks like the logger was not initialised at that stage.Any ideas how I can print these.

I have increased the points to 30 .Thanx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.