Boost logo

Boost :

Subject: Re: [boost] Is disabling boost log auto flush the only way to control the log flush? Or can you change log auto flush rate?
From: hh h (jupiter.hce_at_[hidden])
Date: 2018-12-13 22:38:20


Thanks Andrey.

I am using OpenWrt, it seems to me that OS filesystem does not have
mechanism to handle write data in two stages, so I have to use manual
flush I am currently implementing which works well anyway.

Thank you very much.

JHH

On 12/13/18, Andrey Semashev via Boost <boost_at_[hidden]> wrote:
> On 12/13/18 6:55 AM, hh h via Boost wrote:
>> Hi,
>>
>> I use boost log in an embedded system where flushing log message to
>> flash storage need be controlled. I could not find how to change log
>> auto flush rate, is it the only way to disable auto flush
>> boost::log::keywords::auto_flush = false? I think there must be a way
>> to change a desired log flush rate value without disabling auto flush,
>> appreciate any tips.
>
> Auto flush is disabled by default, you don't need to disable it explicitly.
>
> When not enabled, the rate of flushing is system dependent - basically,
> it happens when C/C++ runtime library detects its internal buffer
> overflow when Boost.Log tries to write a new record to the file stream.
> I'm not aware of any ways to influence that, so the flush will happen at
> least that often. Additionally, you can flush the stream buffer manually
> by calling flush() on the logging core or the sink at the points you
> feel appropriate.
>
> However, I should note that flushing the buffer from Boost.Log side does
> not necessarily mean writing the data to the flash media. Normally, the
> flush operation simply invokes the OS write operation, which places the
> data in the filesystem cache to write it later. The OS may combine
> multiple such write operations in the cache before the data is actually
> written to the media. If it is the flash media health that concerns you,
> you should research how you can tune filesystem cache in your OS first,
> before tampering with your application, as this will give the most
> tangible benefit, even beyond writing logs.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk