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

   > @SnobbyVirus1973, `NoSqlAppender` doesn't support lookups in the 
additional fields. Hence, what you want is not really possible at this stage 
_"out of the box"_ – that is, you can make it work (by creating your own 
`NoSqlAppender`, etc.), but you really would not want to do that, and it should 
ideally fixed by Log4j.
   
   Yes it does support runtime lookups (see [Runtime evaluation of 
attributes](https://logging.staged.apache.org/log4j/2.x/manual/appenders.html#runtime-evaluation)
 I recently revamped). It just does not pass the log event as argument to 
`StrSubstitutor`, so some lookups don't work.
   
   > @ppkarwasz, I am in favor of keeping `PatternLayout` out of the picture 
and instead simply allowing lookups in the additional fields of 
`NoSqlAppender`. Plugging in `PatternLayout` drags along a myriad of other 
complications.
   
   After auditing the lookup code, I came to the conclusion that `StrLookup` 
might be one of those abstractions we should consider dropping:
   
   * Lookups evaluated at configuration time could simply be replaced by values 
provided by `PropertiesUtil`. I doubt users employ at the same time 
`${sys:MY_VALUE}` and `${env:MY_VALUE}`. The namespacing of lookups is often 
source of confusion. `${MY_VALUE}` would be simpler.
   * Lookups evaluated at runtime make only sense if they depend on the log 
event. Currently all the lookups that use the data of a log event have an 
equivalent `PatternConverter`.
   
   See my recent [thread on 
`dev@logging`](https://lists.apache.org/thread/15w3kol5fppqsv8mo1v5xp2ww6joczz0).
   
   I agree that `PatternParser` is heavier than `StrSubstitutor`, but 
`PatternParser` parses an expression only once. `StrSubstitutor` parses a value 
each time it is called.


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