-
Notifications
You must be signed in to change notification settings - Fork 36
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
Send GlobalContext.Properties and MachineName:ProcessId #1
Conversation
Possibility to specify (statically and dynamically) fields which should be taken from 'GlobalContext.Properties'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I'll approve these changes soon, and will release a new version after I'll make some changes of my own (mainly support non-string types and better threads handling).
@@ -38,14 +42,30 @@ private void WriteImpl(LoggingEvent loggingEvent) | |||
{"thread", loggingEvent.ThreadName}, | |||
{"message", loggingEvent.RenderedMessage}, | |||
{"exception", loggingEvent.GetExceptionString()}, | |||
{"user", loggingEvent.UserName}, | |||
// log4net already adds this 'username' property which is added to values bellow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
key = key.Replace(":", ""); | ||
key = key.Replace(".", ""); | ||
key = key.Replace("log4net", ""); | ||
values["property" + key] = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the property prefix? do you think the "key" string would collide with other fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well.. collision is possible. I thought would be nice to have a clear separation of these properties. On the other hand its not really needed and can be without 'property' prefix. In some cases it is even more nice instead of 'propertyIdentity' to have 'Identity'. So I leave it for you to make final decision here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I did some major changes, including support for objects (non-string) in fields. You may grab the last revision if you want, or wait until I'll finish with the other improvements and release an official version. Thank you.
* merge SerializeLogEvents* to one function *change MediaTypeHeaderValue to application/json
* add gzip Compression * Add Compression option to ship the logs, by default this option is on false, need to add this option to the documentation. * fix HttpClientHandler to work with "application/jso" * * clean unused imports (#1) * merge SerializeLogEvents* to one function *change MediaTypeHeaderValue to application/json * delete compression in sanity test (#2)
Possibility to specify (statically and dynamically) fields which should be taken from 'GlobalContext.Properties'.