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

   > Do you agree that `PropertiesConfigurationBuilder` should not throw? 
Unlike the Log4j plugin builder case we discussed recently, in this case the 
exception is not caught and always propagates to the caller (the caller usually 
being `LogManager.getLogger()`).
   
   @ppkarwasz, AFAIU, I agree that we should *not throw, but log* on 
`LogManager.getLogger()`. That said, I prefer not to explode the amount of 
corner case checks by succeeding each `var x = createX();` line with a `if (x 
== null) { LOGGER.error(...); return null; }`. I presume the issue is that 
`PropertiesConfigurationBuilder::build` should not throw. Can we implement is 
as follows?
   
   ```java
   
   public PropertiesConfiguration build() {
       try {
           return unsafeBuild();
       } catch (Exception error) {
           LOGGER.error("...", error);
           return null;
       }
   }
   
   private PropertiesConfiguration unsafeBuild() {
       // Existing `build()` methods throwing exceptions
   }
   ```


-- 
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