Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not read configuration file [log4j.properties].

 
Ameya Thakur
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !!
Did any one face this problem on WSAD5.1
I have put the log4j.properties in the classpath also , but it did not worked. The location of log4j.properties is the Root Directory..

Can somebody help me out in figuring this Issue


log4j:ERROR Could not read configuration file [log4j.properties].
java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at java.io.FileInputStream.<init>(FileInputStream.java:86)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:306)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at at com.cs.services.logging.Log4JEventLogger.<clinit>(Log4JEventLogger.java:61).null(Unknown Source)
at com.cs.services.logging.EventLoggerFactory.init(EventLoggerFactory.java:33)
at com.cs.services.logging.EventLoggerFactory.createEventLogger(EventLoggerFactory.java:27)
at com.cs.domain.EntityNameMap.initialize(EntityNameMap.java:175)
at at com.cs.domain.EntityNameMap.<clinit>(EntityNameMap.java:77).null(Unknown Source)
at com.cs.domain.entities.ConfigParametersMap.getConfigForEntityTag(ConfigParametersMap.java:44)
at com.cs.domain.entities.PatientProgramEntityImpl.getConfig(PatientProgramEntityImpl.java:105)
at com.cs.domain.entities.PatientProgramEntityImpl.<init>(PatientProgramEntityImpl.java:78)
at com.cs.domain.ejb.PatientProgramEntityBean.<init>(PatientProgramEntityBean.java:96)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:79)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
at java.lang.Class.newInstance3(Class.java(Compiled Code))
at java.lang.Class.newInstance(Class.java(Compiled Code))
at com.ibm.ejs.container.EJSContainer.loadBeanMetaData(EJSContainer.java:1349)
at com.ibm.ejs.container.EJSContainer.getHomeWrapperCommon(EJSContainer.java:1012)
at com.ibm.ejs.container.EJSContainer.getHomeInstance(EJSContainer.java:934)
at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:913)
at com.ibm.ws.runtime.component.EJBContainerImpl.startBean(EJBContainerImpl.java:1301)
at com.ibm.ws.runtime.component.EJBContainerImpl.install(EJBContainerImpl.java:1034)
at com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:1508)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:128)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:105)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)
log4j:ERROR Ignoring configuration file [log4j.properties].




Thanks & Regards
Ameya
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A little bit of logic:

If you had put the properties file in the classpath, then log4j would be able to find it. But log4j cannot find it. Therefore you did not put it in the classpath.

If the root directory was part of the classpath then you would have put the properties file in the classpath. But you did not put the properties file in the classpath. Therefore the root directory is not part of the classpath.

A good place to put log4j.properties in a web application is in the WEB-INF/classes directory.
 
Ameya Thakur
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul!!

Thanks for the response...I am using Websphere 5.1 and I have put it in the WebSphere Classpath and also added in the root directory of the project....

One Important Thing which i would like to tell you is that we have our own logging API's which we are no longer going to use.. we are going to use the LOG4J from future realses of our product.......We ar not making any changes in the code i.e where logger is called.

So we have wrote our own Log4JLogger which would be called by the code and internally there would ba Log4jProxy which would called the log4j api's..


The following line is failing

org.apache.log4j.PropertyConfigurator.configure("log4j.properties");

If you can tell me which path does propertyConfigurator looks for log4j.properties

Thanks & Regards,
Ameya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic