Serilog.Sinks.Network icon indicating copy to clipboard operation
Serilog.Sinks.Network copied to clipboard

Uri scheme must be tcp or tls

Open stianl opened this issue 5 years ago • 1 comments

According to the documentation configuring the Sink using a hostname and port should be valid:

var urlLogger = new LoggerConfiguration()
    .WriteTo.TCPSink("some.url.com", 1337)
    .CreateLogger();

Howerver, when I attempt this I get the following exception:

An unhandled exception of type 'System.UriFormatException' occurred in Serilog.Sinks.Network.dll: 'Uri scheme must be tcp or tls' at Serilog.Sinks.Network.NetworkLoggerConfigurationExtensions.BuildUri(String s) at Serilog.Sinks.Network.NetworkLoggerConfigurationExtensions.TCPSink(LoggerSinkConfiguration loggerConfiguration, String uri, ITextFormatter textFormatter, LogEventLevel restrictedToMinimumLevel)

Is this an error in the documentation, or a bug?

stianl avatar Nov 14 '19 12:11 stianl

I appreciate this comment is very late :)

That does look like a failure of documentation.

TCP sink only has two constructors. One that takes an IP address, and one that takes a URI

Presumably, that documentation should reference "tcp://some.url.com". But should write a test to confirm that!

pauldambra avatar Sep 06 '21 06:09 pauldambra