File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes log4j in WebSphere5.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "log4j in WebSphere5.1" Watch "log4j in WebSphere5.1" New topic

log4j in WebSphere5.1

Sam De Albin

Joined: May 10, 2004
Posts: 3
hi all

Does anybody know , how to configure log4j in websphere 5.1?? First, I developed my application for weblogic 7.1. then i ported to websphere 5.1. log4j was working fine in weblogic. But, in websphere everything is fine except log4j. Do i need to add any special entries in server specific xml files???

plz help me......

Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Moving to the IBM/Websphere Forum...
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32319

What error are you getting?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 364
I set up log4j in WebSphere just like anywhere else, I'd imagine. Create a servlet with init method:

public void init()
String prefix = getServletContext().getRealPath("/");
String file = getInitParameter("log4j_conf");
if (file != null)
PropertyConfigurator.configure(prefix + file);


and then in the web.xml file make sure load-on-startup is set to 1 and the log4j_conf init param value is set to the path to the file. No worries...

No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Sam De Albin

Joined: May 10, 2004
Posts: 3

i doesnt get any error!! in the file , I mentioned the file name of the logger. But, that file is not at all there when I run the pgm. Should I create a blank file before starting the Application???

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: log4j in WebSphere5.1
It's not a secret anymore!