mattwcole / gelf-extensions-logging

GELF provider for Microsoft.Extensions.Logging
MIT License
109 stars 42 forks source link

No support for TCP logging #64

Closed joepb closed 2 years ago

joepb commented 2 years ago

On less than optimal networks, UDP isn't the best protocol, as it's a fire-and-forget setup. Http(s) is very poorly supported by Graylog and is very slow in processing input.

TCP on the other hand has proven to be stable and more reliable. It comes with some small performance considerations, but in some operations, reliability would outweigh the performance.

mattwcole commented 2 years ago

Thanks this looks great, I was hoping someone would add TCP support. Should be able to give this a quick review and merge early next week.

joepb commented 2 years ago

I added some logic to the MR to make the logger thread-safe. I found a few occurrences in production scenarios where two simultaneous threads writing resulted in messages being malformed.

A TCP Socket will be opened per thread writing to prevent the locking of threads (which could be a severe performance hit). If the logging mechanism is smart enough to consolidate onto one thread (which it seems to be in most cases), there should be no overhead of this thread localization.

mattwcole commented 2 years ago

Added in #69.