Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using dots in property configuration names #108

Open
doojonio opened this issue Apr 14, 2021 · 2 comments
Open

Using dots in property configuration names #108

doojonio opened this issue Apr 14, 2021 · 2 comments

Comments

@doojonio
Copy link

Hi, I am using property configuration. And now I need to use dots in names for some fields. For example:

JsonLayout.field.browser.name = Firefox

In this case I want to get field like that:

field->{'browser.name'} == 'Firefox'

So I propose to use some char sequence as dot. For example if we gonna use '~1' char sequence as dot, than configuration, which will look like this:

JsonLayout.field.browser~1name = Firefox

And field hash will look like this:

field->{'browser.name'} == 'Firefox'

Can we do this? I can create pull request for this, if you like this idea

@mohawk2
Copy link
Collaborator

mohawk2 commented Jun 1, 2022

I think you'd be able to have this right now with the code as it is, if you just use e.g. _ to be your escape character, with __ as literal underscore, then _1A3_ be the hexadecimal escape "1A3"? (and obviously decode that where you need to do so)

@mkende
Copy link

mkende commented Oct 23, 2024

While support could be added in each client library that needs it, I believe the syntax would be nicer if it was supported right away in Log::Log4perl::Config::PropertyConfigurator. For example this would allow to write something like (using the same example as in the initial request):

JsonLayout.field.browser\.name = Firefox
# or, with an alternative syntax
JsonLayout.field."browser.name" = Firefox

Of course this change in supported syntax would be risky so it would need to be protected behind some kind of flag, but this would solve this issue for everybody once and for all.

For reference, I’m also here because of the JsonLayout module with which I’m trying to write Google Cloud Structured Logging messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants