Support & Documentation
Follow

Stackify API for .NET

You can log messages directly via the Stackify API without the use of a logging framework.  You can get more information at the Stackify Github page.

Please note that we recommend using NLog, Serilog, or log4net. Those frameworks allow you to send your logs to multiple different outputs. If you decide to not use Stackify products in the future, your code also isn't hard coded against Stackify's libraries by using a logging framework. 

Download the Stackify API

Download the Stackify API

To get the Stackify API package, enter the following command into the Package Manager Console:

Install-Package StackifyLib

When prompted, enter your Activation Key found in the Settings Tab of the Stackify Portal.

A Note About Error Results on Unmonitored Servers

If you are logging errors from a server that doesn't have a Stackify monitoring agent on it, you have to add an Environment key to the appSettings section of your configuration, as it cannot be inferred by Stackify without an agent running on the machine.

It should also be noted that if you are logging errors for your application and that application doesn't appear as an app in the App Stacks page, the only way to see error telemetry is from the global Error Dashboard page, as there will be no App Dashboard for that application if it's not installed on a server that is being monitored.

Below is the required configuration entry if logging from an unmonitored server:

<appSettings>
      <add key="Stackify.ApiKey" value="Your Activation Key" />
      <add key="Stackify.AppName" value="Your App Name"/> <!-- optional - will be inferred by Stackify if this is running on a monitored server -->      <add key="Stackify.Environment" value="Your Environment"/> <!-- optional - will be inferred by Stackify if this is running on a monitored server -->
</appSettings>

Syntax for Using the API

Syntax for Using the API

You will notice in the code sample above that the Stackify library offers both standard logging via the Queue() method, as well as Exception Logging via the QueueException() method. When logging anything other than an exception, use Queue(). When logging an exception, you will want to use QueueException() so that the error will show up in the Error Dashboard and will also include full stack trace details and other information that is only captured when using QueueException().

Adding Additional Debug Information

Adding Additional Debug Information

If there are custom properties that you want to add to your logged details, you can easily add them as shown above.

View Logs in the Dashboard

View Logs in the Dashboard

After you configure your App with the Stackify API, you will be able to see your logging messages in the Logs Dashboard.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk