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
-[Best practices for logging with C#](https://stackify.com/csharp-logging-best-practices/)
13
13
-[Why you should use tags in your logs](https://stackify.com/get-smarter-log-management-with-log-tags/)
@@ -22,7 +22,7 @@ Library for Stackify users to integrate Stackify in to their projects. Provides
22
22
-[Direct API](#direct-api)
23
23
-[Configuring with Azure service definitions](#configuring-with-azure-service-definitions)
24
24
25
-
##Basics
25
+
##Basics
26
26
27
27
Several nuget packages are available for Stackify's core API as well as various logging frameworks. Please install the proper packages. All of the available packages for various logging frameworks are wrapper on top of StackifyLib which can also be used directly for logging.
Please note that Newtonsoft.Json is used by StackifyLib but is embedded as a resource to avoid version conflicts. Costura.Fody is being used to embed it. If you have any issues with Newtonsoft.Json as a result of using StackifyLib please contact Stackify support.
89
88
90
-
##Errors and Logs
89
+
##Errors and Logs
91
90
92
91
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.
93
92
94
93
95
-
###NLog 2.0.1.2 - v3.1+
94
+
###NLog 2.0.1.2 - v3.1+
96
95
97
96
**Install via NuGet package**
98
97
```
@@ -131,7 +130,7 @@ Options
131
130
- CallContextKeys is an additional feature unrelated to NLog that uses the local thread storage for more advanced tracking of context variables. 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.
132
131
- logMethodNames - Method names will show up in the StackifyLog viewer most of the time as the class name that did the logging. For exceptions it will usually show the method name. To enable the exact method name for all logging, set this property to true. Note that it does cause a small performance hit due to walking the StackTrace.
133
132
134
-
###log4net v2.0+ (v1.2.11+)
133
+
###log4net v2.0+ (v1.2.11+)
135
134
136
135
**Install via NuGet package**
137
136
```
@@ -181,7 +180,7 @@ Options
181
180
- logMethodNames - Method names will show up in the StackifyLog viewer most of the time as the class name that did the logging. For exceptions it will usually show the method name. To enable the exact method name for all logging, set this property to true. Note that it does cause a small performance hit due to walking the StackTrace.
182
181
183
182
184
-
####log4net Extension Methods
183
+
####log4net Extension Methods
185
184
186
185
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.
187
186
@@ -196,7 +195,7 @@ logger.Debug(dictionary); //This works fine and is indexed and searchable by Sta
196
195
logger.Debug("Starting some process for client 1", dictionary); //extension method
Note: If you use 1.2.10 then you must use our special nuget package for that version. There is no way to use an assembly redirect because the public key of log4net v1 and v2 are different. Everything else is the same about using log4net with Stackify.
*Make sure you call StackifyLib.Logger.Shutdown() before your app ends to flush the queue*
235
234
236
-
###Configuring with Azure service definitions
235
+
###Configuring with Azure service definitions
237
236
238
237
StackifyLib reads the license key, app name, and environment settings from normal web.config appSettings. If you would prefer to store the settings in an [azure cloud deployment cscfg](http://msdn.microsoft.com/en-us/library/azure/hh369931.aspx#NameValue), then you can create a little code to read the settings from there and set the StackifyLib settings in code like this in some similar way.
0 commit comments