datalust / serilog-sinks-seq

A Serilog sink that writes events to the Seq structured log server
https://datalust.co/seq
Apache License 2.0
239 stars 50 forks source link

Serilog can't write to Seq #137

Closed fsantiago99 closed 4 years ago

fsantiago99 commented 4 years ago

Hi! I've implemented serilog on powershell and it works in write to file or to console, but not to seq.

There's no error but no output. Can you help me? There's my code:


[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.Sinks.File.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.Sinks.Console.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.Sinks.PeriodicBatching.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.Sinks.Seq.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\Serilog.Formatting.Compact.dll") | Out-Null
[System.Reflection.Assembly]::LoadFrom("C:\Users\filipe.santiago\TestSerilog\System.Net.Http.dll") | Out-Null

$serverUrl = "http://localhost:5431/"

$Config = New-Object Serilog.LoggerConfiguration

[Serilog.SeqLoggerConfigurationExtensions]::Seq($Config.WriteTo, $serverUrl, `
    [Serilog.Events.LevelAlias]::Minimum, 1000, $null, $null, $null, $null, 256*1024, [Serilog.Events.LogEventLevel]::Information, `
    $null, $null, 10000) | Out-Null

[Serilog.Log]::Logger = $Config.CreateLogger()

[Serilog.Log]::Error("Logging error")
[Serilog.Log]::Information("Logging started")

[Serilog.Log]::CloseAndFlush() 
nblumhardt commented 4 years ago

Hi! This looks okay to me at first glance; have you tried enabling Serilog.Debugging.SelfLog? Could be some clues in its output 🤔

fsantiago99 commented 4 years ago

Hi! This looks okay to me at first glance; have you tried enabling Serilog.Debugging.SelfLog? Could be some clues in its output 🤔

How I can enable this feature? Can you try my code?

nblumhardt commented 4 years ago

Hi! https://github.com/serilog/serilog-sinks-seq#client-side-issues shows how SelfLog is hooked up (in C#). I don't have time to run this right now, sorry.