[Cppcms-users] question about booster::log
Brought to you by:
artyom-beilis
|
From: chenshu <csf...@gm...> - 2011-10-13 06:29:46
|
Hello,
I tried booster::log today.If I added sink explicitly below,it worked
fine,and I could see the log info in log file.
void init_log(){
booster::shared_ptr<booster::log::sinks::file> f(new
booster::log::sinks::file());
f->open("my_log");
booster::log::logger::instance().add_sink(f);
}
int main(int argc,char ** argv){
try {
init_log();
BOOSTER_ERROR("module") << "Message " << 3.14159;
....
}
2011-10-13 06:18:44 GMT; module, error: Message 3.14159 (main.cpp:72)
But if I configured it in config.js like so,I couldn't see any log
info,only log file was created.
"logging":{
"level":"debug",
"file":{
"name":"km_log",
"append":false,
"max_files":100
}
}
I looked into your codes and found some code here:
std::string log_file;
if(!(log_file=settings().get("logging.file.name","")).empty()) {
booster::shared_ptr<sinks::file> file(new sinks::file());
int max_files=0;
if((max_files = settings().get("logging.file.max_files",0)) > 0)
file->max_files(max_files);
bool append = false;
if((append = settings().get("logging.file.append",false))==true)
file->append();
file->open(log_file);
logger::instance().add_sink(file);
}
It looked the same as mine code.So no idea now.
|