You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you log an object with the message, Stackify's log viewer makes it easy to search by these parameters. You can always search by the text in the log message itself, but searching by the logged properties provides a lot more power. If you always logged a "clientid" for example on every log message, you could search in Stackify for "json.clientid:1" and quickly see all logs and errors affecting that specific client. Another big difference and advantage to logging objects is you can do a range type search "json.clientid:[1 TO 10]" which would not be possible by a straight text search.
nlog.Debug("Test message", new { clientid=2, color="blue" });
130
139
```
131
140
132
-
Options:
141
+
**Options:**
133
142
134
143
- IncludeEventProperties - Include LogEvent-Properties for structured logging.
135
144
- IncludeMdlc - Include NLog MappedDiagnosticsLogicalContext MDLC-Properties for structured logging.
@@ -156,7 +165,7 @@ Note: Nuget packages are compiled against 2.0.0 (1.2.11) but any newer version w
156
165
</dependentAssembly>
157
166
```
158
167
159
-
Sample config:
168
+
**Sample config:**
160
169
```xml
161
170
<log4net>
162
171
<root>
@@ -183,7 +192,7 @@ Sample config:
183
192
</log4net>
184
193
```
185
194
186
-
Options
195
+
**Options:**
187
196
188
197
- GlobalContext, ThreadContext, and LogicalThreadContext keys are fully supported by setting the parameters in the config as a comma delimited list of keys. See sample config above.
189
198
- CallContextKeys is an additional feature unrelated to log4net that uses the local thread storage for more advanced tracking of context variables. LogicalThreadContext provides the same functionality but uses an internal property collection. We have seen instances where the serialization of that collection can cause exceptions. This was created as an alternative method to the built in function. It is used via CallContext.LogicalSetData(key, value). Research LogicalSetData online to learn more. It is supposed to work better across child Task objects and with async.
@@ -194,7 +203,7 @@ Options
194
203
195
204
log4net does not internally have methods for logging a log message along with an object. Stackify's appenders work fine if you log an object directly or we have created some friendly extension methods to make it easy to log an object with your message at the same time.
0 commit comments