[logback-user] Context configuration during webapp loading
subscriber at blackbrook.org
Wed Aug 22 20:53:12 CEST 2012
I'm trying to use variable substitution for my log file names, using the
webapp / context name. (My use case is not literally a shared
configuration, but two webapps deployed using copies of the same war
with different names...so they each have their own logback.xml, though
they are identical). I'm using the example on
http://logback.qos.ch/faq.html#sharedConfiguration as my basis, and
while it is working, my webapp ends up creating two log files.
First it creates one called application-name_IS_UNDEFINED.log with some
of the first messages logged during startup, and then foo.log (where foo
is the app name) with all subsequent messages. So it seems to me that
the contextInitialized method of ServletContextListener isn't early
enough, and that the default logback config is initializing earlier.
This is using Tomcat 7, and Java 7.
How can I either hook into the earlier initialization or replace it?
Where does that initialization happen? Is that static code?
More information about the Logback-user