• 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

Maven package and log4j.properties

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following the excellent tutorial at http://maven.apache.org/guides/getting-started/index.html
I used 'mvn package' to create an executable jar. The jar includes META-INF/log4j.properties. However, when the application is run with the command:
java -jar my-app-1.0-SNAPSHOT-jar-with-dependencies.jar

The log4j.properties file is not found.
log4j:WARN No appenders could be found for logger (org.myorg.my-app).
log4j:WARN Please initialize the log4j system properly.

Obviously log4j.properties is not on the classpath but everything was done according to the tutorial, I'm at a loss as to what is missing.

Any help or guidance would be appreciated.

-=beeky
 
William Stafford
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm answering my own question in case this post turns up in a search. The short answer is that what I was seeing is expected behavior. Log4j is not expecting to have to find its' config file in a jar file. A copy of the config file must exist on the classpath regardless of what is in the jar file.

-=b
 
reply
    Bookmark Topic Watch Topic
  • New Topic