?
Solved

Logging with boost to both console and file

Posted on 2014-01-20
3
Medium Priority
?
1,722 Views
Last Modified: 2014-01-20
There is good example to log to either console or file. But how do you configure to log to console and file at the same time?

I am using Boost 1.55.0

Thanks
0
Comment
Question by:tommym121
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 39795705
You could add multiple sinks to the logger, e.g. like

boost::log::sinks::synchronous_sink< boost::log::sinks::text_file_backend> fileSink;
boost::log::sinks::synchronous_sink< boost::log::sinks::text_ostream_backend> consoleSink;

//...

boost::log::core::get()->add_sink(fileSink);
boost::log::core::get()->add_sink(consoleSink);

Open in new window

0
 

Author Closing Comment

by:tommym121
ID: 39795912
Thanks.
0
 
LVL 86

Expert Comment

by:jkr
ID: 39795917
You're most welcome ;o)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question