{"action":"created","issue":{"url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/75","repository_url":"https://api.github.com/repos/serilog/serilog-sinks-splunk","labels_url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/75/comments","events_url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/75/events","html_url":"https://github.com/serilog/serilog-sinks-splunk/issues/75","id":258244430,"number":75,"title":"`Method not found` while configuring sink with `WriteTo.EventCollector`","user":{"login":"gitting","id":3186756,"avatar_url":"https://avatars2.githubusercontent.com/u/3186756?v=4","gravatar_id":"","url":"https://api.github.com/users/gitting","html_url":"https://github.com/gitting","followers_url":"https://api.github.com/users/gitting/followers","following_url":"https://api.github.com/users/gitting/following{/other_user}","gists_url":"https://api.github.com/users/gitting/gists{/gist_id}","starred_url":"https://api.github.com/users/gitting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitting/subscriptions","organizations_url":"https://api.github.com/users/gitting/orgs","repos_url":"https://api.github.com/users/gitting/repos","events_url":"https://api.github.com/users/gitting/events{/privacy}","received_events_url":"https://api.github.com/users/gitting/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-16T17:02:35Z","updated_at":"2017-09-18T01:26:18Z","closed_at":null,"author_association":"NONE","body":"When working in the context of Azure Functions, either locally using func cli (`func host start`) or once uploaded to Azure, sometimes, apparently with a certain combination of various packages/target frameworks/etc., I get the following exception during a call to create logger:\r\n\r\n```\r\nException while executing function: Functions.SomeFunc\r\nMicrosoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.SomeFunc ---> System.AggregateException : One or more errors occurred. ---> Method not found: 'Serilog.LoggerConfiguration Serilog.SplunkLoggingConfigurationExtensions.EventCollector(Serilog.Configuration.LoggerSinkConfiguration, System.String, System.String, System.String, System.String, System.String, System.String, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, Boolean, Int32, Int32, System.Net.Http.HttpMessageHandler)'.\r\n   at Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetTaskResult(Task task) at C:\\azure-webjobs-sdk-script\\src\\WebJobs.Script\\Description\\DotNet\\DotNetFunctionInvoker.cs : 455\r\n   at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()\r\n   at System.Threading.Tasks.Task.Execute()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.InvokeCore(Object[] parameters,FunctionInvocationContext context) at C:\\azure-webjobs-sdk-script\\src\\WebJobs.Script\\Description\\DotNet\\DotNetFunctionInvoker.cs : 276\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) at C:\\azure-webjobs-sdk-script\\src\\WebJobs.Script\\Description\\FunctionInvokerBase.cs : 95\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker`2.InvokeAsync[TReflected,TReturnType](TReflected instance,Object[] arguments)\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)\r\n  …\r\n```\r\n\r\nThe call producing the error is:\r\n\r\n```CSharp\r\nreturn new LoggerConfiguration()\r\n    .Enrich.WithMachineName()\r\n    .WriteTo.EventCollector(host, token)\r\n    .WriteTo.RollingFile( ... )\r\n    .CreateLogger()\r\n```\r\nThe whole execution fails at this point, obviously. Commenting out the `EventCollector` line gets rid of the exception and the `RollingFile` continues to work fine.\r\n\r\nIt appears a few mentions of a similar problem can be found elsewhere, specifically:\r\n\r\n- https://github.com/serilog/serilog/issues/294\r\n- https://github.com/serilog/serilog-sinks-seq/issues/70\r\n- https://stackoverflow.com/questions/41187875/method-not-found-serilog-loggerconfiguration\r\n- perhaps more...\r\n\r\nIt looks like in most if not all cases there's some sort of package versioning problem. For me it works when I use the following combination:\r\n\r\n- `Serilog.Sinks.Splunk v2.3.0`\r\n- `Microsoft.Extensions.DependencyInjection v1.1.1`\r\n\r\nUpgrades are available for both packages listed above. Upgrading either or both causes the exception."},"comment":{"url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/comments/330108698","html_url":"https://github.com/serilog/serilog-sinks-splunk/issues/75#issuecomment-330108698","issue_url":"https://api.github.com/repos/serilog/serilog-sinks-splunk/issues/75","id":330108698,"user":{"login":"gitting","id":3186756,"avatar_url":"https://avatars2.githubusercontent.com/u/3186756?v=4","gravatar_id":"","url":"https://api.github.com/users/gitting","html_url":"https://github.com/gitting","followers_url":"https://api.github.com/users/gitting/followers","following_url":"https://api.github.com/users/gitting/following{/other_user}","gists_url":"https://api.github.com/users/gitting/gists{/gist_id}","starred_url":"https://api.github.com/users/gitting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitting/subscriptions","organizations_url":"https://api.github.com/users/gitting/orgs","repos_url":"https://api.github.com/users/gitting/repos","events_url":"https://api.github.com/users/gitting/events{/privacy}","received_events_url":"https://api.github.com/users/gitting/received_events","type":"User","site_admin":false},"created_at":"2017-09-18T01:26:18Z","updated_at":"2017-09-18T01:26:18Z","author_association":"NONE","body":"Thanks for looking into it.\r\n\r\nI don't believe there's anything particular in my setup:\r\n\r\n- the Function App is implemented [as a library](https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/) using no special tooling\r\n- the runtime version of Azure environment shows `1.0.11184.0 (~1)`\r\n\r\nThis particular time running it locally in `azure-functions-core-tools@1.0.4` CLI is fine as opposed to in Azure. One other time, a few versions of the CLI and packages back, it was the other way around. I did not document what the versions were and what happened when it disappeared. That situation was more tolerable since to run it locally I'd just disable splunk sink."}}
{"actor":{"display_login":"gitting"}}