-
Notifications
You must be signed in to change notification settings - Fork 370
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
[Log4Net]: Adds snippet showing how to set Log4Net properties as Google Cloud log entry labels. #5618
Conversation
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.
A couple of suggestions, but nothing major.
// Resource: log4net-custom-labels-template.xml log4net_custom_labels_template | ||
// Sample: Custom_Labels | ||
// Configure log4net to use Google Cloud Logging from the XML configuration file. | ||
XmlConfigurator.Configure(LogManager.GetRepository(GetType().GetTypeInfo().Assembly), new FileInfo("log4net.xml")); |
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.
I suspect GetTypeInfo()
can be removed everywhere now - we only didn't have it in netstandard1.*
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.
Ah yes, will remove from all snippets.
// Set a property using one of the GlobaContext, ThreadContext or LogicalThreadContext classes. | ||
LogicalThreadContext.Properties["property_for_label"] = "my label value"; | ||
// Log some information. This log entry will be sent to Google Cloud Logging with a label | ||
// {"label_from_property", "my label 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.
Possibly explain that the mapping from "property_for_label" to "label_from_property" is part of the configuration? I thought this was a typo at first.
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.
Yep!
…oud log entry labels. Towards googleapis#5325
f1a4bab
to
ab03a58
Compare
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.
Comments adressed. Will merge on green save objections. Thanks!
// Resource: log4net-custom-labels-template.xml log4net_custom_labels_template | ||
// Sample: Custom_Labels | ||
// Configure log4net to use Google Cloud Logging from the XML configuration file. | ||
XmlConfigurator.Configure(LogManager.GetRepository(GetType().GetTypeInfo().Assembly), new FileInfo("log4net.xml")); |
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.
Ah yes, will remove from all snippets.
// Set a property using one of the GlobaContext, ThreadContext or LogicalThreadContext classes. | ||
LogicalThreadContext.Properties["property_for_label"] = "my label value"; | ||
// Log some information. This log entry will be sent to Google Cloud Logging with a label | ||
// {"label_from_property", "my label 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.
Yep!
Towards #5325