Using Serilog to send Logs to Railtown AI

by

Paulo de Araujo

May 13, 2021

4 Min

reads

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:

Code:

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

AppInsightsBest Tools to Integrate with Railtown.ai

Railtown.ai helps you gather the information you need to efficiently resolve an error, but by combining our application with other tools can take your developer workflow to the next level. So today, we’d like to go through 2 popular tools that we recommend for expanding your team’s capabilities: New Relic and Azure Application Insights.

by

Marwan Haddad

January 6, 2023

5 Min.

reads

CultureHow to Build a Positive Culture Within Development Team on Debugging

Too many software development teams treat error logging as a burden rather than a chance to grow.That’s why Jeli’s “Howie: Post-Incident Guide” felt like a breath of fresh air. In the guide, Jeli’s team notes that negative treatment of bugs is everywhere, including the language we use to describe software development. Terms like “post-mortem” and “root-cause analysis” speak for themselves.We’d like to build on the suggestions put forward in Howie and share our perspective on error logging as well. So let’s take a look at how a small mindset shift around debugging could encourage more positive moments in your team.

by

Marwan Haddad

December 1, 2022

5 Min

reads

Error BucketNode.js Monitoring: Performance Monitoring Best Practices

Plenty of developers who start coding in Node.js do so because of how easy it is to get started. But once you are ready to take your application to the next level, you need to take a step back. Why did you choose to build in Node.js, and where do you want to take your application from here? To scale your Node.js application, you need to figure out just how to use performance monitoring to your advantage.

by

Marwan Haddad

November 21, 2022

5 Min

reads