Boost logo

Boost Users :

Subject: [Boost-users] Newby help with Boost::Log
From: Davies, John (john.davies_at_[hidden])
Date: 2018-11-08 13:50:24


I'm using Boost Log to capture all keypresses in my embedded device. I want to be able to store at most 3 files of a certain size and rotate them. That's working.

My problem is a scenario like this:
The device is inserting data into Log_009.log which is in the base folder. In the log folder are Log_006.log, Log_007.log, and Log_008.log.
The program stops and restarts. This may be due to some keypress that was logged in Log_009.log.
When it restarts, it clears out Log_009.log and starts it over - losing the last logged keypresses

Ideally, I'd like Boost Log to just keep appending to Log_009.log, but my reading online says that this isn't possible. My second favorite solution would be that Log_009 gets rotated and Log_010.log is started. Anything so I don't lose data.

Here is my configuration:
       logging::add_common_attributes();

       logging::add_file_log
              (
              keywords::file_name = "KeyLog_%3N.log",
              keywords::target = "./Logs",
              keywords::rotation_size = 500, // 10 * 1024 * 1024,
              keywords::format = "[%TimeStamp%]: %Message%",
              keywords::auto_flush = true,
              keywords::min_free_space = 30 * 1024 * 1024,
              boost::log::keywords::max_size = 20 * 1024,
              keywords::enable_final_rotation = true,
              keywords::scan_method = sinks::file::scan_matching,
              keywords::max_files = 3
       );

Can you see what I'm missing? If a program exits via a crash, does final rotation occur? Maybe I need something like enable_initial_rotation.

Thanks for the help,
John

________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net