justinas-dabravolskas opened a new issue, #4036:
URL: https://github.com/apache/logging-log4j2/issues/4036

   ## Description
   Upgrading to Log4j 2.25.0 introduces a regression in properties-based 
configuration when the top-level appenders property lists only a subset of the 
defined appenders. At startup, Log4j throws:
   ConfigurationException: No type attribute provided for component appender
   
   This appears to be caused by the new processing of “remaining” root-level 
properties in PropertiesConfigurationBuilder.build(), which now folds leftover 
dotted prefixes (like appender.) into synthetic components and then requires a 
type on the container key appender. In prior releases, extra appender. groups 
not listed in appenders did not cause a failure. 
   It was introduced by 
[commit](https://github.com/apache/logging-log4j2/commit/c299479b03aa0eeb2baca64e39b017d649b0e09b#diff-a398802ec75cb65f7576c05a7235bb60947c2fa51d1ca57f70bc667f45597724)
   
   ## Expected behavior
   - Properties configs that specify **appenders = …** should not fail if 
additional **appender.<id>.*** groups exist but are not listed.
   1. Only the listed (or referenced) **appenders** should be instantiated; 
unlisted groups should not trigger a root-level component parse or an 
exception. 
   
   ## Configuration
   **Version:** >= 2.25.0
   
   ```
   # Root logger configuration
   status = warn
   name = PropertiesConfig
   
   appenders = console
   
   # Console appender
   appender.console.type = Console
   appender.console.name = Console
   appender.console.target = SYSTEM_OUT
   appender.console.layout.type = PatternLayout
   appender.console.layout.pattern = %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} 
- %msg%n
   
   appender.console2.type = Console
   appender.console2.name = Console
   appender.console2.target = SYSTEM_OUT
   appender.console2.layout.type = PatternLayout
   appender.console2.layout.pattern = %d{HH:mm:ss.SSS} [%t] %-5level 
%logger{36} - %msg%n
   ```
   
   ## Logs
   
   ```
   Caused by: org.apache.logging.log4j.core.config.ConfigurationException: No 
type attribute provided for component appender
        at 
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.createComponent(PropertiesConfigurationBuilder.java:362)
        at 
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.processRemainingProperties(PropertiesConfigurationBuilder.java:206)
        at 
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.build(PropertiesConfigurationBuilder.java:190)
   Caused by: org.apache.logging.log4j.core.config.ConfigurationException: No 
type attribute provided for component appender
   
        at 
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:56)
        at 
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:34)
        at 
org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:544)
        at 
org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:463)
        at 
org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:321)
        at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:778)
        at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:808)
        at 
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:311)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:160)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:48)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:139)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:557)
        at com.l4jmre.App.<clinit>(App.java:11)
   ```
   
   ## Reproduction
   An example configuration throws the above exception. 
   
   ## Workarounds
   - Remove the appenders line entirely (let names be inferred), or
   - List all defined appenders: appenders = console, console2 
   
   Both avoid the synthetic root-level “component appender” and the resulting 
exception.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to