Announcement Announcement Module
Collapse
No announcement yet.
SLF4J/Log4J logging failed after migration to dm server 2.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SLF4J/Log4J logging failed after migration to dm server 2.0

    Hi,

    We have some bundles that use SLF4J and Log4J for logging. They worked fine on dm server 1.0. However, after we migrated to dm server 2.0, the logging failed. Essentially an empty log file would be created but nothing was written to the file.

    Is this because dm server 2.0 uses Logback? Do we need to add some configuration in serviceability.xml? Currently each bundle uses its own log4j.xml.

    Thanks a lot!

    Wei

  • #2
    dm Server 2.0 uses LogBack for its logging, but you should be able to use this via the SLF4J API. Please consult the available documentation. I guess the easiest way forward would be to get a trivial logging example working and then play spot the difference with your failing app. All dm Server's logging requests use the SLF4J API and work just fine...

    Comment


    • #3
      One of the problems i faced with logging was because both slf4j and log4j have same package org.apache.log4j package names.

      I had experiences where application in pickup automatically resolved to slf4j in Dm Repository and I never got the logs.

      Hence whenever u intend to use log4j in ur application use bundle-symbolic-name with the import for it to be resolved with log4j.

      Comment


      • #4
        In general, I would recommend using the SLF4J API provided by logback and avoid using log4j. You can configure the global logging behaviour in serviceability.xml and put logback configuration inside bundles that need bundle-specific logging behaviour.

        Comment


        • #5
          Glyn,

          I am aware you can configure logging in the global DMS serviceability.xml.

          But I was not aware you could configure bundle-specific behavior. How would you do that exactly?
          Last edited by blahb; Jun 8th, 2010, 02:14 PM.

          Comment


          • #6
            I haven't done it personally so I urge you to consult the excellent LogBack documentation. Essentially you should add a logback.xml file to the root of the bundle. If you hit problems or would like to share your findings, please post back.

            Comment

            Working...
            X