From 39af63841bb767e7cddbf5e4f07e7502fefb497e Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 21 Sep 2011 15:21:30 -0500 Subject: [PATCH] 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. --- src/LogMgr.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/LogMgr.cc b/src/LogMgr.cc index 171d0532d7..8ace966245 100644 --- a/src/LogMgr.cc +++ b/src/LogMgr.cc @@ -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::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(