--- title: "How to Log With the Stackify API" slug: "logs-using-stackify-api-for-net" description: "Get information on downloading the Stackify API, using the API, adding additional debug information, viewing logs in the dashboard, and error results." updated: 2018-06-16T07:06:21Z published: 2018-06-16T07:06:21Z canonical: "docs.stackify.com/logs-using-stackify-api-for-net" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.stackify.com/llms.txt > Use this file to discover all available pages before exploring further. # Logging With the Stackify API 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](https://github.com/stackify/stackify-api-dotnet#basics). Use a Logging Framework!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. Our logging appenders for NLog, log4net, and Serilog simply "wrap" around StackifyLib. If you plan to use StackifyLib directly for logging, we suggest at least abstracting and centralizing how you call it incase you decide not to use it later. ## 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 > Account Info page of the Retrace Portal. ## Syntax for Using the API You will notice in the code sample below 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(). ```csharp try { StackifyLib.Logger.Queue("DEBUG", "Entering MyMethod()"); } catch (Exception ex) { StackifyLib.Logger.QueueException(ex); } ``` ## 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. ```csharp catch (Exception ex) { StackifyLib.Logger.QueueException(ex, new { customerid = 1 }); } ``` ## Error Results on Unmonitored Servers: If you are logging errors from a server that doesn't have a Retrace monitoring agent on it, you have to add an Environment key to the appSettings section of your configuration, as it cannot be inferred by Retrace 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: ```xml ```