Skip to main content

Posts

Adding File logging into .net Core 2.0 application

Will be making use of Serilog to log for our application. To get started we need the following Nuget packages. Serilog.AspNetCore Serilog.Settings.Configuration Serilog.Sinks.Console Serilog.Sinks.RollingFile StartUp.cs using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Serilog; namespace MyBlog {     public class Startup     {         public Startup(IConfiguration configuration)         {             Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger(); // <-- add for logging             Configuration = configuration;         }         public IConfiguration Configuration { get; }       ...

Using Gitlab shared Runners

So I was playing around with .Net core and wondering how to make use of Gitlab's CI/CD pipeline without having to set up an external runner. It turns out the process is very simple, in your .gitlab-ci.yml , the first line is to point to a docker image, which will be used for your build. The last important step is in your tags section to refer to one of the tags used by the shared gitlab runners. For example I referred to the docker tag. example of  .gitlab-ci.yml image: microsoft/dotnet stages: - build build: stage: build script: - dotnet build tags: - docker