jean
jean

Reputation: 2990

use boost.log log to multiple file

I had read boost doc. But what it described are too limit for my requirement:

My project has a main logger which used to log almost all logs, it use time_based_rotation. Also I want log some message into another file, so I can check those logs independently rather than mix with main logs together.

What I want is:

BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(gl, boost::log::sources::severity_logger_mt<Logger::severity_level>)
BOOST_LOG(gl::get())<<message; // the main logger

BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(loggerA, boost::log::sources::logger_mt)
BOOST_LOG(loggerA)<<message; // another logger, log to anther file

The problem is: how should I set the logging core? Add a text_multifile_backend? But the usage is totally different than boost example. I feel in my requirement the file name setting should belong to logger rather than logging core, however I don't know how to do that.

Upvotes: 0

Views: 1134

Answers (1)

Arun kumar Kalaiarasan
Arun kumar Kalaiarasan

Reputation: 386

Take a look at this page, You may get some idea.

My program doesn't support thread safe logging while using boost library

Upvotes: 0

Related Questions