This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

log4jConfigLocation completely ignored in web.xml file for Spring MVC webapp

 
Ranch Hand
Posts: 42
Oracle Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm experiencing a very strange issue with log4jConfigLocation parameter and log4j configuration loading.

I defined an external configuration directory for my web application, where the log4j.xml file is located as well as for the logs directory.
For example, I have:
c:/myConfigDir/logs
c:/myConfigDir/log4j.xml

I defined a System JVM variable like config.dir="C:/myConfigDir" and this is what I've put in my web.xml:



This is the content of log4j.xml file:



It looks like the log4jConfigLocation param value is totally ignored in web.xml and it is reading something else. Indeed, if I put whatever name for the file, this is what I still get in the console, when the application in loading in tomcat 7:


Notice the name file is log4jdd.xml which is not existing.

The result is some INFO logging in the console.
I really don't know why this is happening.


By the way: I've also tried to create a very simple Spring MVC test web application, and all I've described above doesn't happen!
Could you please help me to debug this issue?
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start by removing the reference to the system variable, and hard-code your config directory in all of those files. See what changes when you do that.
 
Francesco Bellini
Ranch Hand
Posts: 42
Oracle Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying.

Yes, but I've already done it and nothing changes actually. That's the first attempt I've tried. I've also tried to go in debug into spring-web and spring-core source packages through Log4jConfigListener class, but I didn't figure out anything meaningful.
 
Francesco Bellini
Ranch Hand
Posts: 42
Oracle Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No more ideas?

I think the problem is due to the fact that the following part is not loaded before all:



Really strange.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
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!