Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No request is made, no error thrown #95

Closed
mtman opened this issue Aug 8, 2018 · 4 comments
Closed

No request is made, no error thrown #95

mtman opened this issue Aug 8, 2018 · 4 comments

Comments

@mtman
Copy link

mtman commented Aug 8, 2018

Steps

dotnet new console -n serilog-splunk-issue
cd serilog-splunk-issue
dotnet add package serilog
dotnet add package serilog.sinks.splunk

Program.cs:

using System;
using Serilog;

namespace serilog_splunk_issue
{
    class Program
    {
        static void Main(string[] args)
        {
            Serilog.Debugging.SelfLog.Enable(Console.Error);
            
            var log = new LoggerConfiguration()
                .WriteTo.EventCollector("http://192.168.0.11:8088/services/collector", "ea6595dc-72f2-40fd-94c5-c93300dc0158")
                .CreateLogger();

            log.Information("test");
        }
    }
}
dotnet run

Result

No console output.

No records were added.

Fiddler doesn't show any request to 192.168.0.11

@merbla
Copy link
Contributor

merbla commented Aug 8, 2018

Hi @mtman,

Can you try calling log.CloseAndFlush(), under the hood this sink uses the period batching sink so events are not immediately flushed. Middleware and frameworks such as ASP.Net do this sometimes as the request pipeline level. You will find similar behaviour in other HTTP sinks.

Hope this helps!

@mtman
Copy link
Author

mtman commented Aug 8, 2018

That was indeed the problem. Thanks a lot.

@mtman mtman closed this as completed Aug 8, 2018
@vsix27
Copy link

vsix27 commented Oct 8, 2022

it looks like there is no method CloseAndFlush() anymore...
i can write message to splunk from curl but not from java or .net core... no errors, ne messages
in curl i have splunkhost https://localhost:8088/services/collector, in .net/java using https://localhost:8088 (tried with services/collector too)

@j2jensen
Copy link

@vsix27 Log.CloseAndFlush() just calls the Dispose() method on the default logger instance. Have you tried calling Dispose()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants