ppkarwasz commented on issue #2679: URL: https://github.com/apache/logging-log4j2/issues/2679#issuecomment-2211679687
Looking at [bash parameter expansion](https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html), I would propose to just introduce a simple escape mechanism that allows users to escape the closing `}` as `\}`. The initial example would then need to be written as: ``` <PatternLayout pattern="${env:TZ:-%d{yyyy-MM-dd HH:mm:ss\}{GMT+00\}}"/> ``` This does not make the escaping rules coherent, but at least they are simpler: - the sequence `${` is escaped as `$${`, - the sequence `:-` is escaped as `:\-`, - the sequence `}` is escaped as `\}`. Using `\` as a generic escaping mechanism is not possible for backward compatibility, since the default replacement could be a Windows path. **Note**: Currently `StrLookup` allows nested lookups anywhere between `${` and the closing `}`. I would prefer to limit them to the default value part. So `${foo:-${bar}}` would be allowed, but `${${foo}${bar}}` wouldn't. I really don't see a reason why the names to lookup should be compose by other lookups. -- 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]
