[logback-dev] [JIRA] Updates for LOGBACK-1701: Rules registered with newRule do not trigger

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Oct 20 13:53:00 CEST 2022


logback / LOGBACK-1701 [Open]
Rules registered with newRule do not trigger

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1701

==============================
 Issue created
------------------------------

Bertrand Renuart created this issue on 20/Oct/22 1:40 PM
Summary:              Rules registered with newRule do not trigger
Issue Type:           Bug
Affects Versions:     1.3.4, 1.4.4
Assignee:             Logback dev list
Components:           Joran, logback-core
Created:              20/Oct/22 1:40 PM
Priority:             Major
Reporter:             Bertrand Renuart
Description:
  New rules registered with the <newRule> keyword don't seem to be activated.
   Example:
  {code:java}
  <configuration>
    <newRule pattern="*/stack" class="...." />
  
    <stack .../>
  </configuration>
  {code}
  This sample configuration produces the following messages when debug is enabled:
  {code:java}
  INFO ... NewRuleAction - About to add new Joran parsing rule [*/stack, <classname>].
  ...
  WARN ... ImplicitModelHandler - Ignoring unknown property [stack] in [ch.qos.logback.classic.LoggerContext]
  {code}
  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()|https://github.com/qos-ch/logback/blob/v_1.4.4/logback-core/src/main/java/ch/qos/logback/core/joran/spi/SimpleRuleStore.java#L78-L89].
  
  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.


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the logback-dev mailing list