Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1125

Enable the use of Janino together with logback in an OSGi environment

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • 1.5.7
    • 1.1.3
    • logback-core
    • None
      • logback-core
      • Janino library
      • OSGi environment

    Description

      Problem

      As stated in the Logback documentation conditional processing in configuration files requires the Janino library. When running in an OSGi environment (e.g. an Eclipse RCP application) simply placing commons-compiler.jar and janino.jar on your application's class path is not sufficient enough. You will get the following exception:

      <...>
      12:50:47,754 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
      12:50:47,755 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [stdout] to Logger[ROOT]
      12:50:47,755 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [file] to Logger[ROOT]
      12:50:47,810 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction -
        Failed to parse condition [property("instance").equals("PRODUCTION_ENV")] org.codehaus.janino.JaninoRuntimeException:
        Cannot load class 'ch.qos.logback.core.joran.conditional.PropertyWrapperForScripts' through the parent loader
        at org.codehaus.janino.JaninoRuntimeException
      <...>
      

      Proposed solution

      The org.codehaus.janino bundle needs a Require-Bundle: ch.qos.logback.core directive in it's manifest file in order for the bundle class loader to be able to load classes from the ch.qos.logback.core bundle. This can be achieved by extending the org.codehaus.janino bundle via a fragment (ch.qos.logback.contrib.logback-janino-fragment).

      GitHub PR

      Link to pull request on GitHub implementing this solution.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            zaunerc Christoph Zauner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: