Jul 19th, 2010, 09:42 AM
Configuring Logging on Spring DM Server v1.X
I have been struggling to figure out how to setup logging in my application that is being deployed to Spring DM Server v1.0, and developed with Spring tool suite.
I am planning to use slf4j as the logging api, and either log4j or LogBack as the provider.
I am new to OSGi, but have done a lot of web (servlet) development in the past. In my web projects when using log4j, I simply included the log4j jar file in my WEB-INF/lib directory, and included either a log4j.properties or log4j.xml (with appropriate configuration information) file in the classpath, and things worked.
When working with bundles in Spring DM server things appear to be quite different. It appears that DM server ships with several slf4j related bundles in the repository/ext directory. So I likely do not need to deploy my own slf4j or log4j bundles. Is that right? Do I need to do anything special so that all of my bundles will be able to use these DM-server-provided logging bundles? (Other than including the appropriate Import-Package statement in my bundle's manifest, like this:
But how do I tell sl4j which logging provider I want to use?
How do I configure slf4j?
I know that in config/server.config, using JSON syntax I can configure the logging level and specify logger-filters to constrain the logging. Like this:
"*" : "debug",
"com.wavecorp.cm.server.local.head.utils.AccountUt ils" : "warn",
"com.wavecorp.cm.server.local.head.utils.AssetUtil s" : "error"
Is this the best mechanism to use to configuring logging in DM Server v1.0?
In addition to this, I need a mechanism to specify appenders (like the console, or a particular rotating log file, etc.) Does the JSON syntax in the config/server.config file support appender?
Any advice or pointers to documentation would be GREATLY appreciated.