Fix broctl cluster log rotation (addresses #619)

Before Log::rotation_control was removed in fe38c22d, it was used to
lookup rotation inverval at the time of installing a rotation timer,
and could fall back on the &default=default_rotation_inverval.  But
now since filter rotation information is instead transferred to a Writer
when it's created, it also needed to be taught to fall back on the
default rotation interval.
This commit is contained in:
Jon Siwek 2011-09-21 15:21:30 -05:00
parent f53d5fe0b9
commit 39af63841b

View file

@ -1266,7 +1266,9 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
winfo->postprocessor = 0;
// Search for a corresponding filter for the writer/path pair and use its
// rotation settings.
// rotation settings. If no matching filter, is found fall back on
// looking up the logging framework's default rotation interval.
bool found_filter_match = false;
list<Filter*>::const_iterator it;
for ( it = stream->filters.begin(); it != stream->filters.end(); ++it )
{
@ -1274,12 +1276,20 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
if ( f->writer->AsEnum() == writer->AsEnum() &&
f->path == winfo->writer->Path() )
{
found_filter_match = true;
winfo->interval = f->interval;
winfo->postprocessor = f->postprocessor;
break;
}
}
if ( ! found_filter_match )
{
ID* id = global_scope()->Lookup("Log::default_rotation_interval");
assert(id);
winfo->interval = id->ID_Val()->AsInterval();
}
InstallRotationTimer(winfo);
stream->writers.insert(