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

Rules registered with <newRule> do not trigger

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 1.4.4, 1.3.4
    • Joran, logback-core
    • None

    Description

      New rules registered with the <newRule> keyword don't seem to be activated.
      Example:

      <configuration>
        <newRule pattern="*/stack" class="...." />
      
        <stack .../>
      </configuration>
      

      This sample configuration produces the following messages when debug is enabled:

      INFO ... NewRuleAction - About to add new Joran parsing rule [*/stack, <classname>].
      ...
      WARN ... ImplicitModelHandler - Ignoring unknown property [stack] in [ch.qos.logback.classic.LoggerContext]
      

      After some investigations it happens that the new Action rule is created but not actually registered in the rule store - the code is commented, see SimpleRuleStore#addRule().

      As far as I can tell, the SimpleRuleStore now expects rules to be registered using a Supplier<Action> instead of a rule instance. Unfortunately, the <newRule> action is not updated and keeps registering instances instead of a supplier.

      This prevents from registering and using custom rules in a Logback XML configuration.

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            brenuart Bertrand Renuart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: