• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Maven package and log4j.properties

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!