Using Serilog to send Logs to Railtown AI


Paulo de Araujo

May 13, 2021

4 Min


Sending your logs to Railtown AI using Serilog is very simple.

I will create a very simple console application and add the steps to this article.

To completely follow this article and send your first log to Railtown using Serilog you will need to have your account provisioned so you can get the Railtown Key and add it to your project.

Make sure you sign up following this link to our page.

First, let’s open Visual Studio 2019 and create a C# console application. By the way, I am using the  Visual Studio 2019 Community Edition.

Open Visual Studio 2019 and Create a new project:

Select C# Console Application:

Give a Project and Solution name. I am using RailtownSerilogSampleApp for both and saving it on my personal source repository. Feel free to change to whatever you think is best.

For this example, I am using .NET Core 3.1 as the Target Framework:

Now, let’s add the Railtown Nuget Package. Right-click at your project and click on Manage Nuget Packages:

Search by Railtown and you should see the below package list.

Make sure you select Serilog.Sinks.Railtown:

We need to store and pass the Railtown Key so that our Serilog Sink can identify your project and environment properly.

Once your account is provisioned, you can log in to Railtown and get your Key.

The following page should show after a successful login:

After clicking on the highlighted gear icon from the above screenshot, you should be redirected to a page where you can configure your environment and also get your Railtown Key.

This is how the configuration page for my personal project looks like. Note that I expanded the development environment and selected the Serilog Configuration tab. As you can see this page already shows how to connect Serilog to Railtown.

For this sample, we will need to copy only the key which is highlighted in the screenshot below.

Now let’s add the key to a configuration file so we can retrieve it later and pass it as a parameter for the Railtown Serilog Sink.

Add an Application Configuration File to your project and name it as App.config:

Make sure to set the Copy to Output Directory property of the config file to Copy if newer.

Your App.config file should have the appSettings section and the RailtownKey as the Key and paste the key that you copied from the project config page:

Now for the final step, let’s create the code and send the first log to Railtown.

Open the Program.cs file and copy the code below:


Log in to Railtown and you will be able to see your first log which should look like this one:

Now you see how easy it is to set up Serilog integration start using it in your applications today and let us help you improve the quality of your software.

Keep reading

Root CauseHow AI Can Detect Software Bugs and Root Cause Analysis

Software bugs can be a significant source of frustration for developers and users alike. These errors in code can lead to crashes, data loss, and other issues that can negatively impact the user experience. Identifying and resolving software bugs is crucial for ensuring the quality and reliability of software applications. Artificial intelligence (AI) advances have made it possible to detect and diagnose software bugs more quickly and accurately than ever before


Marwan Haddad

March 29, 2023

5 Min


AppInsightsHow AI Can Help Your Company Save Time on Creating Release Notes

With our Release Notes solution, you can save time for your team by generating all of your release notes automatically. What’s more, our product will give you the freedom of choosing the final format for all of your release notes, be it a summary, a short list, or a full page.


Marwan Haddad

February 6, 2023

3 Min


Root CauseMachine Learning for Solving Root Cause Application Errors & Failures

In today's world, even a single application error could have significant consequences for both businesses and individual developers. From lost revenue and damaged reputation to disrupted services and frustrated customers, the cost of not addressing bugs in your code can be quite high.


Marwan Haddad

January 18, 2023

5 Min