fluent / NLog.Targets.Fluentd

Apache License 2.0
44 stars 31 forks source link

Support for .NET Core? #9

Open mfaizanse opened 6 years ago

mfaizanse commented 6 years ago

Hi, my services are in .NET core, Is this sdk supported by .Net core?

snakefoot commented 6 years ago

PR is ready: #8

moriyoshi commented 6 years ago

The PR was merged. Can you take a look?

snakefoot commented 6 years ago

@moriyoshi Maybe release a nuget-package ?

snakefoot commented 6 years ago

Custom NuGet-package, while waiting for the official nuget.org to be updated (net35, net40, net45 + netstandard20)

NLog.Targets.Fluentd.1.0.5.nupkg.zip (Remove zip-extension after download)

ghost commented 6 years ago

More than a month has passed and it seems the package hasn't been updated @ Nuget. Can you please check it out? @moriyoshi

https://www.nuget.org/packages/NLog.Targets.Fluentd/

snakefoot commented 6 years ago

@kalexii I'm not the owner of the nuget-package. I just helped with updating the source-code to support NetStandard. Can you verify that the unreleased nuget-package is working for you?

@moriyoshi Maybe time to release as official nuget-package?

ghost commented 6 years ago

@snakefoot Well, VS doesn't give me any warnings anymore. I'll follow up once I've wired everything up. TY for the package 👍

ghost commented 6 years ago

@snakefoot

Matter of fact, it throws some weird error. Here's an excerpt from NLog internal log:

2018-03-17 13:25:25.1298 Warn Fluentd Emit - System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at NLog.Targets.FluentdEmitter.Emit(DateTime timestamp, String tag, IDictionary`2 data) in C:\Users\snakefoot\Source\Repos\NLog.Targets.Fluentd\src\NLog.Targets.Fluentd\Fluentd.cs:line 167
   at NLog.Targets.Fluentd.Write(LogEventInfo logEvent) in C:\Users\snakefoot\Source\Repos\NLog.Targets.Fluentd\src\NLog.Targets.Fluentd\Fluentd.cs:line 336

And here's my config:

<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogLevel="info"
      internalLogFile="c:\temp\internal-nlog.txt">
  <extensions>
    <add assembly="NLog.Targets.Fluentd" />
  </extensions>
  <targets>
    <target xsi:type="Fluentd" name="fluentd-target"
            host="host"
            port="port"
            tag="tag"
            emitStackTraceWhenAvailable="true"
            layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
  </targets>
  <rules>
    <logger name="*" minlevel="Debug" writeTo="fluentd-target" />
  </rules>
</nlog>

That error message is rather misleading, because disabling firewall didn't help. Running on Windows 10. If it'll can create a sample project to reproduce this, or if you have any pointers to confirmed working sample I can use, I'm all ears :)

snakefoot commented 6 years ago

Are you missing something here:

            host="host"
            port="port"

Have you tried to open a PowerShell-prompt an run this command to check if host and port can be accessed:

Test-NetConnection -Port 800 -ComputerName 192.168.1.1

Created #10 that adds some extra logging of connection configuration.

ghost commented 6 years ago

@snakefoot I've deliberately replaced actual values with those

snakefoot commented 6 years ago

I have created a modified version of the package with support for SocketOptionName.KeepAlive and use of BufferedStream. Both are said to help against "connection was aborted"-issues.

NLog.Targets.Fluentd.1.0.6.nupkg.zip (Remove zip-extension after download)

ALFNeT commented 5 years ago

Gentle ping to @moriyoshi, would it be possible to update the official nuget package?

chrisdecker1201 commented 4 years ago

You can use https://www.nuget.org/packages/NLog.Targets.Fluentd.NetStandard/ which is fork from here https://github.com/jcapellman/NLog.Targets.Fluentd