• Print
  • Share
  • Dark
    Light

How to Troubleshoot Logging Problems

  • Updated on 30 Oct 2018
  • 2 minutes to read
  • Contributors

This guide is intended to help users who are experiencing problems trying to configure their errors and logs to be sent to Stackify. If you haven’t already, check out our documentation on installing Stackify for your appropriate logging framework. This guide will provide you with a checklist of items that will help troubleshoot what is going on. If you are still not successful in sending logs to Stackify, please contact us at [email protected] and we will do some further investigation.

Step 1. Test Writing Logs to a File

The first step you should check is if you have your logging framework configured correctly. The easiest way to test if your app is configured properly is by adding a file appender to your app. This will help you verify that your logging framework and configuration is all working correctly.

There are a lot of good resources on the web that will help you get started with the framework of your choice.

Log4Net: http://www.codeproject.com/Articles/140911/log-net-Tutorial

NLog: http://www.codeproject.com/Articles/10631/Introduction-to-NLog

If you can successfully write your logs to a file, please go on to step 2.

Step 2. Verify Stackify Configuration

If logs are writing to a file but are not showing up in Retrace’s dashboards, you should first verify that your Stackify.ApiKey activation key is setup in your application configuration. For .NET Framework this would likely be in your web.config appSettings. For .NET core this would be in your settings json file.

Your activation key that can be found on the https://s1.stackify.com/Manage/ManageSubscription page of your account.

Step 3. Enable Stackify's Debug Logging

If both the logging framework and Stackify settings appear to be correctly configured, there are some additional actions you can take to troubleshoot the issue. One helpful tool you can try is enable debugging for Stackify’s logger.

This will capture everything that is attempting to be posted to Stackify’s API and can give you some insight of why the log messages are not reaching Stackify.

More information on how to do this can be found on our Github site.

Below is how this could be implemented:

StackifyLib.Utils.StackifyAPILogger.LogEnabled = true;
StackifyLib.Utils.StackifyAPILogger.OnLogMessage += StackifyAPILogger_OnLogMessage;

static void StackifyAPILogger_OnLogMessage(string data)
{
    Debug.WriteLine(data);
}

Step 4. Try Our Pre-configured Test App

You can download a zip file that contains a sample console application pre-configured to send test logs to Stackify. This zip file can be downloaded here. All you need to do is unzip the ConsoleTest app, enter in your API key, and run the project. This will run some test log messages that should flow into your account and will allow you to compare the project set up to your own app. The Stackify debug settings mentioned in step 3 are already configured in this project, so if logs are still not appearing in your account from this test app, be sure look at the output in Visual Studio for any hints of what could be wrong.