Skip to content
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

Garbage collection every time logs are appended #20

Closed
AdamWilks opened this issue Jan 21, 2019 · 3 comments
Closed

Garbage collection every time logs are appended #20

AdamWilks opened this issue Jan 21, 2019 · 3 comments
Assignees

Comments

@AdamWilks
Copy link

@AdamWilks AdamWilks commented Jan 21, 2019

While investigating some performance issues with a website in am currently working on I discovered that the implementations of LogglyClient and LogglySendBufferedLogs both call GC.Collect() after appending new data.

This is especially bad for applications which produce quite verbose log output as it can trigger constant garbage collections to happen in all 3 generations. In addition under circumstances where the application error rate increases for any reason there is potential for additional garbage collections to worsen the situation.

Best practice guidelines from Microsoft are to only call GC.Collect() for "unique situations and testing" so can these calls be removed, or at least be made configurable?

On a side note, the same files also make calls to Console.WriteLine() if an error occurs when sending. Would it make sense for these to be replaced by something like Debugger.Log()?

@Katulus
Copy link

@Katulus Katulus commented Jan 22, 2019

@AdamWilks , thanks for reporting this. What you describe is really not the intended behavior, we'll look at this.

@Katulus Katulus self-assigned this Jan 22, 2019
@Katulus
Copy link

@Katulus Katulus commented Jan 29, 2019

@AdamWilks , new version (beta) has been just released. You can get it on https://github.com/loggly/log4net-loggly/releases/tag/v9.0.0-beta1 or via Nuget. It's almost complete rewrite and there is no GC.Collect() anymore.

The Console.WriteLine() for error reporting remains (it's actually useful in lots of cases) but we also added Trace.WriteLine() so that you can configure trace listener for this now.

@AdamWilks
Copy link
Author

@AdamWilks AdamWilks commented Jan 30, 2019

Thanks for the quick response @Katulus, that's awesome. We will look at upgrading as soon as we get the chance.

@AdamWilks AdamWilks closed this Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.