Results 1 to 4 of 4

Thread: Configure Log4J in Spring DM server

  1. #1

    Default Configure Log4J in Spring DM server

    I would like to use my existing log4j configurations with its appenders for a simple bundle.
    I've included the following in the MANIFEST.MF:
    Code:
    Import-Bundle: com.springsource.slf4j.org.apache.commons.logging;version="[1.5.6,1.6.0)"
    Import-Package: org.slf4j;version="[1.5.6,1.6.0)",
     org.apache.log4j;bundle-symbolic-name="com.springsource.org.apache.log4j"
    I also have the log4j.properties in the bundle classpath.
    However my log4j appenders aren't being used. How do I configure this correctly?

  2. #2
    Join Date
    May 2009
    Location
    Chicago, USA
    Posts
    87

    Default

    Your log configuration gets set in

    {DM_SERVER_HOME}/config/server.config

    there is a section that looks like:

    "trace": {
    "directory": "serviceability/trace",
    "levels": {
    "*" : "info"
    }
    }

    This configures the log4j (or is it slf4j, whatever) for the server.

    If you add your own entries it would look like:

    "trace": {
    "directory": "serviceability/trace",
    "levels": {
    "*" : "info",
    "com.me.mypackage.*" : "error"
    }
    }

    Make sure you don't miss the ',' (comma) between entries and in this config you don't use "Trace" you use "Verbose". So it's Info, Warn, Error, Verbose... though I think I missed one.

    Then your logs will be found in:

    {DM_SERVER_HOME}/serviceability/trace/{bundleName}-{version}/trace.log

    There is some way to override some of this, it's in the DM Server manual and shouldn't be hard to find...

  3. #3

    Default

    I know about the configration in the server.config file. But that doesn't use Log4J.
    I want to be able to configure my own appenders with a log4J properties file in a bundle.

    The programmers guide mentions that you can use vanilla log4j by the importing the following:
    Code:
    Import-Package: org.apache.log4j;bundle-symbolic-name="com.springsource.org.apache.log4j"
    I am not able to get this working.

  4. #4
    Join Date
    May 2009
    Location
    Chicago, USA
    Posts
    87

    Default

    Oh, apologies, yeah I saw that in the guide too and gave up for now... hahahah.

    If you get it going, please do post what happened.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •