• 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

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

 
Ranch Hand
Posts: 42
Oracle Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic