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
Library for Stackify users to integrate Stackify in to their projects. Provides support for sending errors, logs, and custom metrics to Stackify. Also some support for querying metric data back out of Stackify for use in external projects.
4
7
5
8
**Important links:**
@@ -38,41 +41,52 @@ The packages for log4net, NLog and Elmah all depend on StackifyLib. StackifyLib
38
41
39
42
The following is required in your App.config or Web.config:
40
43
41
-
<appSettings>
42
-
<add key="Stackify.ApiKey" value="YOUR API KEY HERE" />
<addkey="Stackify.Environment"value="OPTIONAL ENVIRONMENT NAME LIKE PROD, DEV" />
49
+
</appSettings>
50
+
```
46
51
47
52
Optionally, you can set the config settings on your machine's environment variables with the same configuration key and value.
48
53
Example are executed in window's cmd as an admin:
54
+
```
55
+
setx Stackify.ApiKey "YOUR API KEY HERE" /m
56
+
setx Stackify.Environment "MY ENVIRONMENT HERE" /m
57
+
```
49
58
50
-
setx Stackify.ApiKey "YOUR API KEY HERE" /m
51
-
setx Stackify.Environment "MY ENVIRONMENT HERE" /m
52
-
53
59
You can set the config settings in code like so which will override the appSettings configs as well.
54
60
55
-
StackifyLib.Logger.GlobalApiKey = "";
56
-
StackifyLib.Logger.GlobalAppName = "";
57
-
StackifyLib.Logger.GlobalEnvironment = "";
58
-
61
+
```
62
+
StackifyLib.Logger.GlobalApiKey = "";
63
+
StackifyLib.Logger.GlobalAppName = "";
64
+
StackifyLib.Logger.GlobalEnvironment = "";
65
+
```
66
+
59
67
By default the library will use the WebRequest.DefaultWebProxy. If you want to set a specific proxy server only for StackifyLib, you can do so in code OR via config.
Note: Nuget packages are compiled against 2.0.0 (1.2.11) but any newer version will work with a valid assembly binding redirect. log4net 2.0.3 is actually 1.2.13 which makes the binding redirect look strange.
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.
If you use a custom logging framework or a framework not currently supported, you can easily send logs to Stackify with our core library and API like so:
204
226
205
-
StackifyLib.Logger.Queue("DEBUG", "My log message");
206
-
StackifyLib.Logger.QueueException("Test exception", new ApplicationException("Sky is falling"));
207
-
208
-
StackifyLib.Logger.Shutdown(); //should be called before your app closes to flush the log queue
*Make sure you call StackifyLib.Logger.Shutdown() before your app ends to flush the queue*
220
244
221
245
### Configuring with Azure service definitions
222
246
223
247
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.
224
248
225
-
public class MvcApplication : System.Web.HttpApplication
0 commit comments