serilog-contrib / serilog-sinks-slack

A simple (yet customizable) Slack logging sink for Serilog
MIT License
41 stars 27 forks source link

Slack webhook only working in dotnet core #18

Closed LaurensvandenBerg closed 3 years ago

LaurensvandenBerg commented 6 years ago

When I set my logger up to sink to a webhook, it works when I test it inside visual studio. The moment I build it however and run the executable, the webhook gets no messages whatsoever. I've tried both Debug and Release mode, none seem to work. [edit]: when running the build in .net 4.6.1 it doesn't work, however it works with .net core 1.1

TrapperHell commented 3 years ago

I just tried this on a Console application targeting .NET Framework 4.6.1. The complete code sample is as follows:

using System;
using Serilog.Sinks.Slack;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
                .WriteTo.Slack(new Serilog.Sinks.Slack.Models.SlackSinkOptions
                {
                    CustomIcon = ":ghost:",
                    CustomUserName = "Test App",
                    WebHookUrl = "https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX"
                })
                .CreateLogger();

            Serilog.Log.Logger.Warning("This is a test.");
            Console.ReadLine();
        }
    }
}

This is working for me, as is .NET Core. Considering the time when this was written and the lack of detail, I will consider this issue resolved.