Comments (9)
Yes, given that the file name is generated only once, there's no practical way to ensure appending happens while file collecting is enabled. Either appending won't happen (because of differing file names) or there will be name clashes when the file is collected. I'm working on a solution, though, so hopefully this problem will be resolved.
from log.
Appending will only work when the generated file name matches an existing file. This means that file names with timestamps will not work well with appending.
from log.
even if it's in the same time? In the example, if I open the application twice in the same minute, two file logs (file-mmddYY_HHMM_00.log
and file-mmddYY_HHMM_01.log
) will be created and the file name is the same.
Or you mean that if using time (any, even if it's just the year) the append is ignored?
from log.
even if it's in the same time?
It's the file names what matters. In your example, the timestamps do match, but the counter value doesn't.
The counter value doesn't match because you call scan_for_files
, which by default updates the starting counter value the sink uses to generate the file name. That call is intended to be used with a file collector, so that the older rotated log files are tracked. You're not using one.
from log.
but if I remove the scan_for_files
, new file still will be created. But instead of xxx00.log
it will be xxx.log000
from log.
oooh, okay... I have to remove the file collector. So it's impossible to append and collect at the same time, is that it?
from log.
Okay, thanks!
Maybe a disclaimer here would be nice. :) I don't know if/how I can upload a documentation ""fix"", otherwise I would add
from log.
If you're interested, you can try if e823f88 helps. With it, you can modify your initialization code like this:
typedef boostlog_sinks::synchronous_sink< boostlog_sinks::text_file_backend > file_sink;
boost::shared_ptr< file_sink > sink(new file_sink(
boostlog_keywords::auto_flush = true,
boostlog_keywords::file_name = "file.log",
boostlog_keywords::target_file_name = "file-%m%d%Y_%H%M_%2N.log",
boostlog_keywords::rotation_size = 5 * 1024 * 1024,
boostlog_keywords::format = "[%TimeStamp%][%ThreadID%] *%Severity%* %Message%",
boostlog_keywords::open_mode = std::ios_base::app
));
from log.
Nice, I'll check it out asap. Thanks!
from log.
Related Issues (20)
- An infinite loop occurs when boost writes to the log file HOT 4
- Timezone information with text file backend HOT 2
- Boost.Log rotation may throw boost::filesystem::filesystem_error HOT 10
- How to add timezone info for log entries and log filename HOT 3
- Formatting TimeStamp HOT 1
- Boost 1.82, boost\Log\trivial unresolved external symbol error if included after curl HOT 3
- Log Formatting [Conan 2.x, C++20, Boost 1.83] HOT 2
- 1.82.0 compiled for XP uses AcquireSRWLockExclusive HOT 2
- How to append log to same log file after program restarts? HOT 1
- CMake integration for Xcode universal 2 builds HOT 1
- boost日志在动态库里被使用,再次在主程序中使用会崩溃 HOT 1
- Boost stopped printing logs after changing the system time HOT 4
- Redundent call to boost_install() HOT 1
- An infinite loop occurs when boost writes to the log file (Debug Mode, Medium size file) HOT 1
- Consider switching dependency from MPL to MP11 HOT 2
- Please consider improving the documentation and examples HOT 1
- Linking failure after upgrading boost to 1.82 from 1.69 HOT 2
- advanced instruction sets HOT 1
- About Scope %f HOT 1
- boost/1.85.0 compile issues with msm::front::state_machine_def on llvm/clang++ 18.1.5 with std=c++20 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log.