Debugging OSGi bundle loading
I have added some support to various parts of the source to help folks understand and debug OSGi bundle loading problems when using webengine. This is currently checked in so if you build from source you should receive it on your next pull. If you don't, it should be included in the 5.2.M4 distribution that is imminent.
Basically, this is a log4j hack. In the log4j.properties file (nxserver/app/config/log4j.properties), there is a new logger that inherits from no other logger so it is totally independent of other logging. This is the bottom section of the file now:
Use this to see only the OSGi bundle debugging information
Use DEBUG to see nuxeo bundles as well (lots more output)
Use WARN to see only webengine OSGi related messages
You'll want to uncomment the last line and choose your log level for this special logger appropriately. If you are new to OSGi, you may find the debug level interesting to walk through so you can see how nuxeo starts up. Most people who are working on their own extensions will probably want to use INFO or even WARN.
Also, you can turn off all the other logging information. Unfortunately, glassfish uses "sun" logging and nuxeo uses "apache" logging so you have to change two files. The sun logging configuration is now in nxserver/app/config/logging.properties:
java.util.logging.ConsoleHandler.level = WARNING
com.sun.enterprise.server.logging.FileandSyslogHandler.level = WARNING
In this sample, I've set the log level to "WARNING" so that under most circumstances you'll get nothing from glassfish. You can do the same at the top of the log4j.properties file--the same one mentioned above--and changing the root logger level. Here is a snippet:
# Set root logger level to DEBUG and its only appender to CONSOLE.
#log4j.rootLogger=INFO, CONSOLE, DEBUG
log4j.rootLogger=WARN, FILE, CONSOLE
Note that apache loggers use "WARN" as the log level, yet "WARNING" is used by sun. Similarly, "ERROR" is used by apache and "SEVERE" by sun.
Hope this helps folks debug problems faster with their user-developed bundles. If you have any questions, just drop me a line at ismith [at] nuxeo.com
Category: Product & Development