Announcement Announcement Module
Collapse
No announcement yet.
Configure Log4J in Spring DM server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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...

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X