• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

LOG4J messages in red about missing configuration file which is IN place

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

i copied a project with eclipse where LOG4J is used

the original project OP has a config file in .\settings\configLOG4J.properties as my new project NP has

the OP inititializes LOG4J ( if i understand it right) like that:




if i do similar:



i get the following WARN:

log4j:WARN No appenders could be found for logger (org.apache.mina.core.filterchain.IoFilterEvent).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

the buildpath and settingsfiolders are identical, what else i am missing ?

regards
dirk
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the link posted in the error message:

log4j uses Thread.getContextClassLoader().getResource() to locate the default configuration files and does not directly check the file system.


That means just copying the file to a relatively similar place doesn't solve the problem, log4j doesn't check the file system. Instead it uses ClassLoaders to find the file - and that means setting up your classpath. Make sure the proper location is set up in your project's classpath.
 
dirk dj jaeckel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:From the link posted in the error message:

log4j uses Thread.getContextClassLoader().getResource() to locate the default configuration files and does not directly check the file system.


That means just copying the file to a relatively similar place doesn't solve the problem, log4j doesn't check the file system. Instead it uses ClassLoaders to find the file - and that means setting up your classpath. Make sure the proper location is set up in your project's classpath.



because other subsystems also using propertiefiles i was pretty sure that this is not the point

in eclipse ( i am starting the apps in eclipse) i cant find a configuration for classpath, i have only buildpath, is this the one you mean ?
i compared the two projects and it seems to be equal, except that one warns and one not
 
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

in eclipse ( i am starting the apps in eclipse) i cant find a configuration for classpath, i have only buildpath, is this the one you mean ?



Right click on project in Package explorer or Navigator > Run As > Run Configurations > Classpath
 
dirk dj jaeckel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aniruddh Joshi wrote:

in eclipse ( i am starting the apps in eclipse) i cant find a configuration for classpath, i have only buildpath, is this the one you mean ?



Right click on project in Package explorer or Navigator > Run As > Run Configurations > Classpath




I added all jars:
/com.djdeejay.cowTrade.client.random.application/lib/forms-1.2.0.jar
/com.djdeejay.cowTrade.client.random.application/lib/log4j-1.2.16.jar
/com.djdeejay.cowTrade.client.random.application/lib/mina-core-2.0.0-RC1.jar
/com.djdeejay.cowTrade.client.random.application/lib/slf4j-api-1.5.2.jar
/com.djdeejay.cowTrade.client.random.application/lib/slf4j-log4j12-1.5.2.jar

in referenced libaries, in libs and in cllasspath ( i tried Bootstrap and userentries) , still no success
 
Aniruddh Joshi
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is the log4j properties file present on your classpath? I think adding it to the classpath should fix it.

What do you mean by

because other subsystems also using propertiefiles i was pretty sure that this is not the point

 
dirk dj jaeckel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aniruddh Joshi wrote:is the log4j properties file present on your classpath? I think adding it to the classpath should fix it.



I dont have the property in the classpath eclips dont shows me an option for that, how can i add a .config file here ?

this is my classpath


What do you mean by

because other subsystems also using propertiefiles i was pretty sure that this is not the point



I have for example a class loading defaultValues.property also from the same folder using also Method Classloader


i found it now:
the original program called a line:

PropertyConfigurator.configure("settings/configLog4j.properties");

i had missing in my code

thanks a lot

 
Aniruddh Joshi
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dirk dj jaeckel wrote:the original program called a line:

PropertyConfigurator.configure("settings/configLog4j.properties");


looks like PropertyConfigurator does the job for you. Cuold you please share the import statement of it?
 
dirk dj jaeckel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aniruddh Joshi wrote:

dirk dj jaeckel wrote:the original program called a line:

PropertyConfigurator.configure("settings/configLog4j.properties");


looks like PropertyConfigurator does the job for you. Cuold you please share the import statement of it?




Here its is


i close the task then ;)
 
reply
    Bookmark Topic Watch Topic
  • New Topic