Questions tagged [boost-log]

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

336 questions
10
votes
3 answers

boost_log example with sinks fails to compile

I was considering using boost_log for one project and right at the beginning I faced following problem. Boost Log Example I found at: http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_file.cpp fails to compile. Other simpler…
brane
  • 585
  • 6
  • 20
10
votes
2 answers

Boost Log run-time optimization

I am using Boost-Log and the global severity logger for my application's logging platform. Profiling shows that the boost::log::v2s_mt_posix::core::open_record can take up to 25% of the total execution time. I do have many log messages BUT I would…
Dimitris Dakopoulos
  • 683
  • 1
  • 6
  • 18
10
votes
6 answers

How to log line number of coder in boost log 2.0?

Can I use LineID attribute for this? I hope I could use sink::set_formatter to do this instead of using __LINE__ and __FILE__ in each log statement.
Dean Chen
  • 3,800
  • 8
  • 45
  • 70
9
votes
2 answers

How to add color coding to boost::log console output?

I'm trying to add colored log output for boost::log under linux. I read the following and I tried this: #define MY_LOG_ERROR() BOOST_LOG_TRIVIAL(error) << "\033[1;31" MY_LOG_ERROR() << "This is an error log." but it gives me the result…
bobeff
  • 3,543
  • 3
  • 34
  • 62
9
votes
1 answer

how to print ProcessID and ThreadID in dec-format with boost.log

I use boost.log in my program, and the default formatter outputs the ProcessID and ThreadID in hex-format, anyone knows how to print them in dec-format, thanks. this is the github of my code : https://github.com/owenliang/boost_asio, thanks. …
9
votes
1 answer

How to reinitialize Boost Log library on fork?

Boost.Log does not support fork(). This is kind of unbelievable, but a ticket comment describes a workaround: [..] so for now it's up to users to reinitialize the library at fork. You can use pthread_atfork to do such reinitialization. Thus my…
maxschlepzig
  • 35,645
  • 14
  • 145
  • 182
8
votes
2 answers

Boost.Log: Support file name and line number

I am trying to make my team go away from log4cxx and try to use Boost.Log v2 instead. Our current log4cxx pattern is rather simple: log4cxx::helpers::Properties prop; prop.setProperty("log4j.rootLogger","DEBUG,…
malat
  • 12,152
  • 13
  • 89
  • 158
8
votes
3 answers

How can I use Boost.Log across DLL boundaries?

I am trying to integrate Boost.Log in a fairly large application that is composed of a main application that dynamically loads plugins from DLLs. The initial idea was to pass a logging source to plugins so that they can add log messages. However, as…
TC.
  • 4,133
  • 3
  • 31
  • 33
8
votes
2 answers

why my format doesn't work in boost log

I am using boost::log in this function: #include #include #include #include void InitLog() { …
Dean Chen
  • 3,800
  • 8
  • 45
  • 70
8
votes
1 answer

Reason for libboost_log_setup.a library?

In the latest Boost 1.54 release I see Boost.Log library appeared. When I compile whole Boost 1.54 I see that for the Log library it produced 2 binaries: libboost_log.a libboost_log_setup.a What is the reason for the libboost_log_setup.a library?…
nogard
  • 9,432
  • 6
  • 33
  • 53
7
votes
1 answer

Boost.log: How to prevent the output will be duplicated to all added streams when it uses the add_file_log() function?

I use the add_file_log() function to initialize a logging sink that stores log records into a text file. When I define several sinks, I have observed: a file is created for each sink. the output is copied to all files. This is my logger: class…
Juan Solo
  • 359
  • 1
  • 5
  • 17
7
votes
1 answer

Is it possible to retrieve the logged message as a string from boost::log::record_view?

The documentation of record_view states that it encapsulates the log message string. I'd like to retrieve it in the context of the consume function of a custom basic_string_backend subclass. Is it possible, or do I have to derive from…
Romain Deterre
  • 546
  • 4
  • 16
7
votes
1 answer

In Boost Log, how do I format a custom severity_level using a format string?

I'm using boost log in my C++ program, and I have a custom severity_logger< severity_level > using a severity_level enum that I defined. Then I create my log sink with the format string "%TimeStamp% [%ThreadID%] %Severity% %Module% - %Message%" but…
Dave Lillethun
  • 2,978
  • 3
  • 20
  • 24
7
votes
1 answer

Overloading << Operator for Boost Logging Object

So I want to use Boost.Log for all my logging purposes. I currently wrote a class that encompasses all the required operations of instantiating and setting up helper methods. Problem is that I want to overload the << operator to use it in a cout…
bge0
  • 901
  • 2
  • 10
  • 25
7
votes
2 answers

Boost.Log unable to set logging filter (undeclared identifier 'severity')

I'm trying to get Boost.Log going in my project. The problem comes in the following line from the trivial example: using namespace boost::log; core::get()->set_filter ( trivial::severity >= trivial::info ); In my code, this translates to the…
aardvarkk
  • 14,955
  • 7
  • 67
  • 96
1
2
3
22 23