erlang-lager / lager

A logging framework for Erlang/OTP
Apache License 2.0
1.12k stars 455 forks source link

Lager version 3.5.2, issue of excessive memory usage #578

Open taoozhou opened 8 months ago

taoozhou commented 8 months ago

04ca062ecfb75c83c05530d64956865

taoozhou commented 8 months ago

My erlang program is deployed in a Docker environment, and the lager writes console logs to the console.log file. However, for unknown reasons, it stores the logs in memory messages instead of writing them to the file.

taoozhou commented 8 months ago

When this issue occurs, the lager no longer writes logs to the console and console.log file, blocking messages in memory and unable to release them, resulting in an increasing memory usage.

The original console log level was debug, but this issue occurred. I adjusted the console log level to warning and wrote the debug level log to a file instead of the console and file. It seems that this issue has been significantly improved, and there has been no problem of excessive memory usage again.

Vagabond commented 8 months ago

and you're not logging to stdout or another non-file backend at all? how many logs do you think you were generaying per second?

taoozhou commented 8 months ago

and you're not logging to stdout or another non-file backend at all? how many logs do you think you were generaying per second?

I output the logs to both the program console and console.log file at the same time, and the speed of the problem depends on the frequency of the log output. When there are more than ten logs per second, this problem occurs in three or four days of college. When there are forty to fifty logs per second or even higher, this problem occurs in less than half an hour.

Perhaps I can send out the tiger configuration file to take a look, but it will need to wait until next Monday.

If I increase the console log level and lower the log level output to the console.log file, can I also solve this problem? Because the system has already been launched into the production environment, when this issue occurred, I set the console and output log levels to a high level, which prevented me from seeing some debug logs and preventing me from stopping my application.

taoozhou commented 8 months ago

After this issue occurred, I changed my lager configuration file and raised the console log level, making it almost impossible for logs to be output to the console. Secondly, I will output the debug logs to a log file. The log output rate may be around 40-50 per second, and there is no memory freeze caused by the inability to output logs to the console and files, which seems to solve this problem.

taoozhou commented 8 months ago

My English proficiency is not very good, and I often use translation software to translate into English, which may cause confusion. I hope you can forgive me.