Questions tagged [boost-log]

The Boost C++ library for logging, focused on simplicity, extensibility and performance

336 questions
1
vote
1 answer

C++ Boost Log: How to use configuration file to rotate and zip logs?

I need to use Boost Logging library to rotate logs and zip the rotated logs, and I want to define it in a configuration file like in here: # Logging core settings section. May be omitted if no parameters specified within…
dgolan
  • 13
  • 2
1
vote
1 answer

Boost.Log: register attributes manually

In my code using Boost.Log I register a formatter for my log output register_simple_formatter_factory("Severity"); This worked as expected for some time but now I tried to build on a different platform and are getting a linker…
sigy
  • 2,408
  • 1
  • 24
  • 55
1
vote
1 answer

Setting up custom format and filter for Boost.Log: nothing happens

I have issues configuring Boost.Log. I want a single, global logger to print to std::cout all messages with severity debug or higher. The format of the message is a simple "foobar: " prefix. What I expect to be printed: foobar: foobar. What is…
Ave Milia
  • 599
  • 4
  • 12
1
vote
1 answer

Building boost::log::formatter on runtime condition

I want to build boost::log::formatter conditionally, however, formatter objects do not seem to behave as 'normal values'. For example: auto sink = boost::log::add_console_log(std::clog); auto format = expr::stream <<…
Amomum
  • 6,217
  • 8
  • 34
  • 62
1
vote
1 answer

Get attribute value for severity in boost::log::sources::severity_logger custom sink backend consume() handler

Imagine, you want to use Boost's boost::log::sources::severity_logger with an endpoint that accepts std::string messages plus an unsigned int severity level. Something like a pimped version of OutputDebugString() in the Win32 API. boost::log is…
Volker
  • 21
  • 3
1
vote
1 answer

Boost log working on W10 but not in ubuntu - segmentation fault

After testing the Boost.log on W10 with Visual Studio 2019, I am trying to have the same application (writes a simple log file) running in ubuntu using the Windows Subsystem for Linux. So, I created a new project with the same source files,…
1
vote
0 answers

Why can I log std::u16strings in Boost.Log without issue on Linux and Mac, but not on Windows?

I am trying to log std::u16strings encoded in UTF-16 via Boost.Log's BOOST_LOG_SEV macro, like this: std::u16string u16str(u"Hello, world!"); BOOST_LOG_SEV(lg,normal) << u16str; On Linux and Mac, the logger does the right thing automatically and…
Kirel
  • 11
  • 1
1
vote
1 answer

Boost.log - Get current file name when using file rotation

I know that this question may be a duplicate but I want to know whether there is still no possibility to get the current log file name when there is a file backend with filename rotation?! Thanks in advance. Edit: With filename rotation I mean…
nOmiTel
  • 73
  • 1
  • 7
1
vote
1 answer

Boost log crashes with a simple example (Linux)

Ok, I know, this question sounds similar to other questions (none of them had been answered), but I cannot figure out why is failing. The simplest example possible is this: #include int main() { BOOST_LOG_TRIVIAL(info) <<…
cprieto
  • 400
  • 2
  • 14
1
vote
1 answer

Problems linking boost-log static on FreeBSD 11.4 works on 12.2

I have used boost log to make a customized sink. I have been using it on Windows for another project and now I used a slimmed down variant of it for another project which shall (must) run on FreeBSD 11.4. I have switched to cmake build in order to…
1
vote
1 answer

Boost use monotonic clock as log timestamp

I use this function to init logging with boost and it works well void initBoostLog(std::string logfile) { boost::log::add_file_log ( boost::log::keywords::file_name = logfile, boost::log::keywords::auto_flush = true, …
bits
  • 309
  • 2
  • 11
1
vote
0 answers

boost.log - A good example of multithreaded writing on a single sink

Assume there is only a single sink (for example a file) and couple of threads are writing their logs on that. I've searched a lot but unfortunately could not find a good example. I've tried multiple channels per threads and got crash. #include…
7eRoM
  • 443
  • 4
  • 14
1
vote
2 answers

Boost Log : File Rotation

I have a doubt about Boost log file rotation. The log file rotation happens based on time and file size. rotation_size = 30 * 1024 * 1024 time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0) When the file reaches mentioned file size,…
indev
  • 125
  • 2
  • 8
1
vote
0 answers

boost log file rotation and compression

I am trying to have a log rotation and compression with boost log. Compression is simple to setup with a gzipped stream and a text stream. But text stream does not handle rotation. How to use a compressor Boost::Iostreams filter as a sink in…
trax
  • 739
  • 8
  • 21
1
vote
1 answer

boost.log error occured while using sink.set_filter

I use boost.log for my project. But when I tried to set filter for sinks, compilation errors came. code are simple: BOOST_LOG_ATTRIBUTE_KEYWORD(MyTag, "My_Tag", std::string); BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS( my_logger ,…
Laine
  • 179
  • 1
  • 8