ppkarwasz commented on PR #2691:
URL: https://github.com/apache/logging-log4j2/pull/2691#issuecomment-2213652711

   @vy,
   
   >     1. Create a new _internal_ (package-private, etc.) 
`ThrowableRenderer<C>` class taking care of `Throwable` (not `ThrowableProxy`!) 
rendering such that:
   
   I would rather retrofit `PatternConverter` with a generic parameter `T` to 
indicate the type of object supported by the converter.
   Then we could create:
   
   - an internal `PatternConverter<Throwable>` implementation that prints 
standard stacktraces.
   - if we need ever need it, in the future we could add a second configurable 
`PatternConverter<Throwable>` implementation that uses a list of 
`PatternConverter<StackTraceElement>` to format stack traces (e.g. add ANSI 
colors).
   
   Such an architecture:
   
   1. would be coherent with what JTL does with `StackTraceElementResolver`,
   2. add more coherence to PL itself, since formatting stack traces and log 
events would use the same `PatternConverter` abstraction (instead of an 
_ad-hoc_ `TextRenderer`).
   
   **Remark**:
   Since 99% of PL users does not specify **any** throwable converter and given 
the complexity of the converter itself, I think we could move the configuration 
of the throwable converter from the `pattern` configuration attribute to a 
nested configuration element.
   
   ```xml
   <PatternLayout pattern="%m%n">
       <ExtendedThrowableConverter 
stackTracePattern="%class.%method(%file:%line)"
                                   maxLines="20"
                                   ignorePackages="org.apache.logging.log4j"/>
   </PatternLayout>
   ```
   
   Seems much clearer to me than the current complex list of options of `%xEx`.


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