I intend to create a common jar which contains all Java Classes related to implementing log4j logging functionality.I have implemented Singleton (GoF) design pattern in a class SLogger to return single instance of log4j across the application. I have created customlogger.jar file with all class files related to log4j logging and lib folder containing log4j-1.2.8.jar file. Following shows the directory structure : -customlogger ----src/ ------com.vilpesh.logger ----lib/ ------log4j-1.2.8 ----META-INF ------MANIFEST.MF
Contents of MANIFEST.MF is Manifest-Version: 1.0 Class-Path: lib/log4j-1.2.8.jar
When i add the customlogger.java in my other application and try to make use of logging functionality i get following error
My other application is deployed in a Websphere application server 6.1.
In the Class SLogger, i have a code statement,which raises error PropertyConfigurator.configure("C://log4j.properties");
Is it possible to refer to log4j.jar from customlogger.jar? I want to make any application in the world to be making use of customlogger.jar. I think the J2EE application server can load the customlogger.jar but it cannot somehow load log4j.jar
In your webapp's WEB-INF/lib folder you should have both customlogger.jar and log4j.jar. Check that for a start.
(I didn't get the part about you implementing a singleton so you could have a single instance of log4j. That seemed pointless to me because log4j already does that sort of thing internally. But maybe you did that to solve a real problem you were having.)