Stackify with C++

Stackify with C++

Logging is extremely important to any application, and I've come to love using Stackify for application logging with C#, Java, and Node.js. Sadly, C++ has been neglected from the Logging as a Service revolution. Yes, you can do log shipping and send your logs to a service, but using a library and directly logging to an API in real time speeds up both development and debugging. I also think it is a bit more elegant. Unfortunately, you will be hard pressed to find a C++ library provided by a LaaS provider and I don't blame them. The C++ logging space is a minefield and there isn't a common logging framework to work from. If you want to waste a day in heated discussions, go get a room full of C++ developers and try to come to an agreement on on a logging library that everyone will use.

This post is a the beginning of a series on using C++ and the Stackify API to get logging on various platforms, and the beginnings of an unofficial SDK. I hope you find something helpful here.

It is important to note that I have no professional affiliation with Stackify. I am a user of their products at my employer and for personal projects.

Getting Started

Logging is platform specific. Logs need metadata from the system like computer name, timezone, and working directory. This results in platform specific code that is contained in each of these samples. Click below to get started on with the platform and method you want to focus on.

Requirements & Miscellaneous

Logging is platform specific and each platform uses different libraries or techniques to get logging metadata from the system where the code is running. To open and use the Stackify-Telemetry-Sample you will need Visual Studio 2017. I use Professional, but I don't expect you would have issues on any version. If you do you can always just copy the code and use it in your own projects and tools.

There were also some bugs I had to fix in the C++ REST SDK version with int_type and VS2017 so if you get an error for this when compiling see Casablanca Fix. It is the #ifdef fix posted by VikingExplorer. I am hoping to remove this section of this post soon. I know it is on Microsoft's radar.

Please note that this is an ongoing project. While the libraries work for logging there is more I can do, and will be adding. If you decide to use these libraries check back often as there will likely be updates and/or bug fixes as I roll these into production on various platforms.

Where is the code?

This main source for this project is currently shared on my personal Github Repository at Stackify-Telemetry-Sample.

The linux project is a little different and covered in the linux post