bruno-garcia / log4net.ElasticSearch

log4net appender to ElasticSearch
https://bruno-garcia.github.io/log4net.ElasticSearch/
Other
219 stars 92 forks source link

Performance issue while generating logs in loop #118

Closed vpatel-fintech closed 4 years ago

vpatel-fintech commented 4 years ago

Hi

I was trying to generate logs using the Log4Net appender.

I have C# client and using log4net version="2.0.8" log4net.ElasticSearch version="2.5.0" log4net.ElasticSearch-AWS version="2.3.5"

Packages to generate the logs and while generating the logs in loop like below

for (int i = 0; i < 100; i++) { //generate logs }

I am only getting 6 to 8 logs only in the index.

below is my appender setting where I want to send data to the server without missing anything.

` ` ` ` ` ` ` ` ` `
bruno-garcia commented 4 years ago

When you call a synchronous method logger.Log it doesn't block the calling thread to flush logs over the network. Instead it queues it up for submission. Your application in a tight loop will always be able to produce more logs than the library can handle. It's simply easier to create more objects in memory than it is to serialize them and send them over the wire.