• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!