Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j in WebSphere5.1

 
Sam De Albin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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......

Sam
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the IBM/Websphere Forum...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,
What error are you getting?
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 log4j_conf.properties file. No worries...
 
Sam De Albin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i doesnt get any error!! in the log4j.properties 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???

Sam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic