rbatis / fast_log

Rust async log High-performance asynchronous logging
Apache License 2.0
240 stars 13 forks source link

How To Limit The Max Ram Buffer #35

Open SohamTilekar opened 1 month ago

SohamTilekar commented 1 month ago

How Can I Limit the Maxim Ram Buffer.

zhuxiujia commented 1 month ago

Our logger currently writes logs to a file only at program termination, risking log loss if the program crashed By External Events. We propose modifying the logger to write logs in real-time from a separate thread, ensuring logs are preserved and immediately available.

  • This Create the Memory Overhead, It Stores the Log in the RAM Which can Overflow the Ram.

did you call log::logger().flush(); method?

zhuxiujia commented 1 month ago

How Can I Limit the Maxim Ram Buffer.

did you use fast_log::init(Config::new().console().chan_len(Some(100000))).unwrap(); to limit Maxim Ram Buffer?

SohamTilekar commented 1 month ago

Our logger currently writes logs to a file only at program termination, risking log loss if the program crashed By External Events. We propose modifying the logger to write logs in real-time from a separate thread, ensuring logs are preserved and immediately available.

  • This Create the Memory Overhead, It Stores the Log in the RAM Which can Overflow the Ram.

did you call log::logger().flush(); method?

But This Can Be Done Automatically in Background Thread with Little to No Overhead.