Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Loggly sink doesn't adhere to Reliability policy of Serilog #54

Open
klinki opened this issue Mar 15, 2020 · 0 comments
Open

Loggly sink doesn't adhere to Reliability policy of Serilog #54

klinki opened this issue Mar 15, 2020 · 0 comments

Comments

@klinki
Copy link

klinki commented Mar 15, 2020

Hello,
I recently configured my application to use loggly sink and I had error in configuration.
This error caused ArgumentNullException which prevented my application from starting.

I believe this goes against Serilog Reliability policy - https://github.com/serilog/serilog/wiki/Reliability which basically says if something fails to be configured, it should not prevent application from functioning.

I believe this sink should be updated to adhere to to Serilog reliablity policy.

Here is my exception stack trace, just for reference.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: CustomerToken is required (Parameter 'CustomerToken')
  at at Serilog.Sinks.Loggly.LogglyConfigAdapter.ConfigureLogglyClient(LogglyConfiguration logglyConfiguration)
  at at Serilog.Sinks.Loggly.LogglySink..ctor(IFormatProvider formatProvider, Int32 batchSizeLimit, TimeSpan period, LogglyConfiguration logglyConfig, LogIncludes includes)
  at at Serilog.LoggerConfigurationLogglyExtensions.Loggly(LoggerSinkConfiguration loggerConfiguration, LogEventLevel restrictedToMinimumLevel, Int32 batchPostingLimit, Nullable`1 period, IFormatProvider formatProvider, String bufferBaseFilename, Nullable`1 bufferFileSizeLimitBytes, Nullable`1 eventBodyLimitBytes, LoggingLevelSwitch controlLevelSwitch, Nullable`1 retainedInvalidPayloadsLimitBytes, Nullable`1 retainedFileCountLimit, String customerToken, String tags, String endpointHostName, LogglyConfiguration logglyConfig, LogIncludes includes)
  --- End of inner exception stack trace ---
  at at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
  at at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  at at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
  at at Serilog.Settings.Configuration.ConfigurationReader.CallConfigurationMethods(ILookup`2 methods, IList`1 configurationMethods, Object receiver)
  at at Serilog.Settings.Configuration.ConfigurationReader.Serilog.Settings.Configuration.IConfigurationReader.ApplySinks(LoggerSinkConfiguration loggerSinkConfiguration)
  at at Serilog.Settings.Configuration.ObjectArgumentValue.<>c__DisplayClass3_0.<ConvertTo>b__0(LoggerSinkConfiguration loggerSinkConfig)
  at at Serilog.Configuration.LoggerSinkConfiguration.Wrap(LoggerSinkConfiguration loggerSinkConfiguration, Func`2 wrapSink, Action`1 configureWrappedSink, LogEventLevel restrictedToMinimumLevel, LoggingLevelSwitch levelSwitch)
  at at Serilog.LoggerConfigurationAsyncExtensions.Async(LoggerSinkConfiguration loggerSinkConfiguration, Action`1 configure, IAsyncLogEventSinkMonitor monitor, Int32 bufferSize, Boolean blockWhenFull)
  at at Serilog.LoggerConfigurationAsyncExtensions.Async(LoggerSinkConfiguration loggerSinkConfiguration, Action`1 configure, Int32 bufferSize, Boolean blockWhenFull)
  --- End of inner exception stack trace ---
  at at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
  at at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  at at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
  at at Serilog.Settings.Configuration.ConfigurationReader.CallConfigurationMethods(ILookup`2 methods, IList`1 configurationMethods, Object receiver)
  at at Serilog.Settings.Configuration.ConfigurationReader.ApplySinks(LoggerConfiguration loggerConfiguration)
  at at Serilog.Settings.Configuration.ConfigurationReader.Configure(LoggerConfiguration loggerConfiguration)
  at at Serilog.Configuration.LoggerSettingsConfiguration.Settings(ILoggerSettings settings)
  at at Serilog.ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration settingConfiguration, IConfiguration configuration, String sectionName, DependencyContext dependencyContext)
  at at Serilog.ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration settingConfiguration, IConfiguration configuration, DependencyContext dependencyContext)
  at PseApi.Startup..ctor(IConfiguration configuration) in C:\work\pse-api\PseApi\Startup.cs:24
  at at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
  at at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
  at at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
  at at Microsoft.AspNetCore.Hosting.StartupLoader.LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, String environmentName)
  at at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass3_0.<UseStartup>b__1(IServiceProvider sp)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
  at at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
  at at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
  at at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
  at at Microsoft.AspNetCore.Hosting.WebHost.EnsureStartup()
  at at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices()
  at at Microsoft.AspNetCore.Hosting.WebHost.Initialize()
  at at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
  at PseApi.Program.Main(String[] args) in C:\work\pse-api\PseApi\Program.cs:18

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

No branches or pull requests

1 participant