-
Notifications
You must be signed in to change notification settings - Fork 67
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
Unable to cast object of type 'Serilog.Sinks.Graylog.Batching.PeriodicBatchingGraylogSink' to type 'Serilog.Core.ILogEventSink' #97
Comments
I've encountered the same problem during runtime. A strange thing I see in the code is: The PeriodicBatchingGraylogSink that implements IBatchedLogEventSink is being casted to the unrelated (!?!) ILogEventSink. public static class LoggerConfigurationGrayLogExtensions
{
///...
public static LoggerConfiguration Graylog(this LoggerSinkConfiguration loggerSinkConfiguration,
BatchingGraylogSinkOptions options)
{
var sink = (ILogEventSink)new PeriodicBatchingGraylogSink(options);
return loggerSinkConfiguration.Sink(sink, options.MinimumLogEventLevel);
} I'd say the bug is introduced in 3.0.0. The PeriodicBatchingGraylogSink class is not tested so this bug should be possible to expose with a creation test. |
It seem to be due to this commit whir1@9e99541#diff-ef82283a7d82597f28e186bce8c709b7c6a276a57ff723c3e845b532e26e3b20L14 Before that, it extended the |
Is it supposed to be something in the lines of this? var sink = new PeriodicBatchingSink(new PeriodicBatchingGraylogSink(options), new PeriodicBatchingSinkOptions
{
BatchSizeLimit = options.BatchSizeLimit,
QueueLimit = options.QueueLimit,
Period = options.Period,
});
return loggerSinkConfiguration.Sink(sink, options.MinimumLogEventLevel); |
Also, why has it been locked to Hardcoded to UDP. |
This seems to have been solved at least. Maybe other issues as well? |
Hey there, I have just upgraded to 3.0.1 and was wondering about the following error:
Thanks!
The text was updated successfully, but these errors were encountered: