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

Ability to add additional fields via log4j #3

Closed
nstielau opened this issue Apr 23, 2011 · 2 comments
Closed

Ability to add additional fields via log4j #3

nstielau opened this issue Apr 23, 2011 · 2 comments

Comments

@nstielau
Copy link
Contributor

Hey,

I'm looking for a way to specify some additional fields via the log4j.properties. In my specific use-case, I'd like to add an environment (dev/staging/production) field, as well as an application (ThisService,ThatService) field. Wondering if you had any thoughts on a general solution. Maybe there could be an 'additionalFields' property whose setter could take query-string like values ('environment=dev&application=myApp'). I could modify the appender for my needs, but this feels like a pretty common use-case. Let me know if you have any ideas. Thanks,

-nick

@t0xa
Copy link
Owner

t0xa commented Apr 23, 2011

Hi Nick,

I thought if GELF is using JSON already why not to pass additional fields as JSON string. Please check my latest commit and tell me if it's okay to use it like this.

Another way is to detect some sort of additional property file (e.g. "gelf.properties") and add fields from it but I'm not sure if this is a good practice.

Anton

@nstielau
Copy link
Contributor Author

AWESOME! That's amazing. Very flexible and clean solution. Thanks for the quick turn-around. I'll try it out soon. -nick

realityforge referenced this issue in realityforge/gelf4j Apr 22, 2012
Option to send name of thread to graylog
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

2 participants