opencog / cogutil

Very low-level C++ programming utilities used by several components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong interaction between stdout flag of different loggers

ngeiswei opened this issue · comments

Problem

Setting the stdout flag of a logger consequently, and incorrectly, sets the stdout flags of other loggers to that same value.

Reproducibility

Enable LoggerUTest::xtestLoggerStdoutFlagInteraction (i.e. remove x)

void xtestLoggerStdoutFlagInteraction()
{
Logger my_logger;
// Set different stdout flags for my_logger and the default logger
logger().set_print_to_stdout_flag(false);
my_logger.set_print_to_stdout_flag(true);
// Make sure their flags differ
TS_ASSERT_DIFFERS(logger().get_print_to_stdout_flag(),
my_logger.get_print_to_stdout_flag());
}

I suspect the problem was introduced while fixing #118

@linas if you happen to have a fix, great, otherwise no worries I'll take care of it.

Hmm. I guess you have it set up so that different loggers write to the same log file? Yeah, that flag seems to be operating at a per-file basis.