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

Support expression evaluation in scan attribute

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 0.9.28
    • logback-classic
    • None

    Description

      At the moment (logback-classic 0.9.28) processScanAttrib method in ConfigurationAction only checks if scan attribute is not empty and if it's not equal to false (so true, but also any non empty string other than false) is enough to enable configuration changes scanning.

      Please add support for expression evaluation (like here: http://logback.qos.ch/manual/configuration.html#conditional ) in scan attribute for the same reason conditional processing of configuration files has been added - so single configuration file can be used in different environments.

      E.g. I'd like to configure scan attribute with following expression:

      <configuration scan='property("app.env").equals("production")' scanPeriod='300 seconds'>

      If janino is not on classpath, same logic can remain for backward compatibility. If janino library is on classpath, and scan is not empty, evaluation should occur - if scan attribute value evaluates to true, only then scanning should be enabled; if scan is not empty and evaluates to false, scanning should not be enabled; if scan is not empty and evaluates to neither true nor false, or exception is thrown, error should be logged.

      This would break backward compatibility only for users which configured scan attribute with non-empty value, which is neither "true" nor "false".

      Attachments

        Activity

          People

            logback-dev Logback dev list
            sslavic Stevo Slavic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: