ppkarwasz commented on issue #3088:
URL: 
https://github.com/apache/logging-log4j2/issues/3088#issuecomment-2665067171

   If you are referring to:
   
   
https://github.com/apache/logging-log4j2/blob/8c0e3c6c4f32ba97985efc05286e5425bfe36742/log4j-core/src/main/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationFactory.java#L47-L51
   
   then **no**, I don't believe we should modify this one. All the other 
implementations of 
[`ConfigurationFactory`](https://logging.apache.org/log4j/2.x/manual/extending.html#ConfigurationFactory)
 also throw an exception, if the underlying file is not a well-formed XML, JSON 
or YAML file.
   
   What I would like to address in this issue are the `throw` statements in the 
[`PropertiesConfigurationBuilder`](https://github.com/apache/logging-log4j2/blob/2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationBuilder.java)
 class. Once we have a syntactically valid Java properties file, we should not 
throw exceptions, because of:
   
   - missing required properties,
   - invalid property values,
   - additional properties that are ignored by Log4j Core.
   
   The Java properties configuration factory is the most complex one, since it 
first transforms Java properties into a tree of 
[`Component`](https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/config/builder/api/Component.html)
 objects and then translates those objects into a tree of 
[`Node`](https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/config/Node.html)
 objects.
   
   The `PropertiesConfigurationBuilder` should only ensure that **each** Java 
property is converted into a `Node` or a node attribute. Therefore it should 
not throw if an appender does not have a `name` attribute:
   
   
https://github.com/apache/logging-log4j2/blob/8c0e3c6c4f32ba97985efc05286e5425bfe36742/log4j-core/src/main/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationBuilder.java#L211-L214
   
   It should simply create a `Component` *without* a `name` attribute.
   
   On the other hand if an appender does not have a `type`:
   
   
https://github.com/apache/logging-log4j2/blob/8c0e3c6c4f32ba97985efc05286e5425bfe36742/log4j-core/src/main/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationBuilder.java#L215-L218
   
   you can not convert the properties into a `Component`, so you should **log 
an error** that tells the user, which properties are being ignored.


-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to