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

   To be more precise, the `StrLookup` parses the string 
`${env:TZ:-%d{yyyy-MM-dd HH:mm:ss}{GMT+00}}` as:
   
   1. A lookup expression (`${env:TZ:-%d{yyyy-MM-dd HH:mm:ss}`), where `env:TZ` 
is the key used for the lookup and `%d{yyyy-MM-dd HH:mm:ss}` is the default 
value.
   2. The literal `{GMT+00}}`.
   
   The main problem here is to have a **coherent** set of escape rules for 
lookup expressions and pattern expressions.
   Right now we have the following escaping rules:
   
   * the special sequence `${` can be escaped as `$${`. This only works for the 
first level of lookups. If `${foo}` expands to `bar`, then `$${foo}` is not 
expanded, but `${$${foo}}` returns the expansion of `${$bar}`.
   * the special sequence `:-` can be escaped as `:\-`, but if `\-` appears 
anywhere else, it will give two characters.
   * the pattern sequence `%d` can be escaped as `%%d`.
   * there is **no** way to escape a closing brace `}` neither in a lookup nor 
in the options of a pattern expression.
   
   This resembles more the way [`cmd.exe` parses a command 
line](https://stackoverflow.com/a/4095133/11748454) than the simpler `bash` 
expansion.
   


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