When deploying my OSGi web application using the equinox servlet bridge i get the following:
log4j:WARN No appenders could be found for logger (org.springframework.osgi.extender.internal.activator.ContextLoaderListener).
log4j:WARN Please initialize the log4j system properly.
I tried several ways of supplying the necessary "log4j.properties" file, including:
Of course I also have a fragment bundle which extends the log4j bundle with a log4j.properties file, but it looks like this log4j bundle is not used.
ADDED: I should add that I'm developing the application in Eclipse... and my fragment bundle which configures log4j / slf4j works there.
Has anyone solved this? Any ideas?
Apache Tomcat. Log4j may be used as the logging framework for Apache Tomcat. This support is implemented automatically by including the log4j-api, log4j-core, and log4j-appserver jars in the boot classpath.
You can do this: %m{nolookups} in the layout. {nolookups} is how you set the property log4j2. formatMsgNoLookups=true within the configuration XML content.
I found my error. The fragment which should provide the log4j.properties file did not include it, because I did not add it to the binary build in build.properties.
I had the same issue and I added log4j.properties
to my /src
folder.
UPDATE: This doesn't really help with your issue...
I am just researching OSGi myself.
Not quite what you're looking for, but the following post discusses the same issue when using vanilla equinox (ie: not hosted within tomcat/jetty).
It suggests creating a 'fragment bundle' (example available for download) to hold your log4j.properties. Perhaps you could try something similar?
Or perhaps you just need to place the log4j.properties
inside META-INF
of your WAR?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With