Skip to content
Snippets Groups Projects
Commit 636eb83f authored by Victor Kotlyar's avatar Victor Kotlyar
Browse files

Fix position for the "status" parameter for "Tape thread complete" and "Tape

session finished" cta-taped log messages always be on the end.
parent 2211b610
Branches
Tags
No related merge requests found
......@@ -41,6 +41,17 @@ void LogContext::pushOrReplace(const Param& param) throw() {
}
}
void LogContext::moveToTheEndIfPresent(const std::string& paramName) throw() {
ParamNameMatcher match(paramName);
std::list<Param>::iterator i =
std::find_if(m_params.begin(), m_params.end(), match);
if (i != m_params.end()) {
const Param param(paramName,i->getValue());
m_params.erase(i);
m_params.push_back(param);
}
}
void LogContext::erase(const std::string& paramName) throw() {
ParamNameMatcher match(paramName);
m_params.erase(std::remove_if(m_params.begin(), m_params.end(), match), m_params.end());
......
......@@ -59,6 +59,14 @@ public:
* @param param
*/
void pushOrReplace(const Param & param) throw();
/**
* Move a parameter with a given name to the end of the container it it
* present.
*
* @param paramName The name of the parameter to check and move.
*/
void moveToTheEndIfPresent(const std::string &paramName) throw();
/**
* Removes a parameter from the list.
......
......@@ -394,6 +394,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::logWithStat(
/1000/1000/m_stats.totalTime:0.0)
.add("driveTransferSpeedMBps", m_stats.totalTime?1.0*(m_stats.dataVolume+m_stats.headerVolume)
/1000/1000/m_stats.totalTime:0.0);
m_logContext.moveToTheEndIfPresent("status");
m_logContext.log(level,msg);
}
......
......@@ -529,6 +529,7 @@ int level,const std::string& msg, cta::log::ScopedParamContainer& params){
/1000/1000/m_stats.totalTime:0.0)
.add("driveTransferSpeedMBps", m_stats.totalTime?1.0*(m_stats.dataVolume+m_stats.headerVolume)
/1000/1000/m_stats.totalTime:0.0);
m_logContext.moveToTheEndIfPresent("status");
m_logContext.log(level, msg);
}
......
......@@ -764,6 +764,7 @@ SubprocessHandler::ProcessingStatus DriveHandler::processSigChild() {
m_sessionEndContext.pushOrReplace({"status", "failure"});
}
// In all cases we log the end of the session.
m_sessionEndContext.moveToTheEndIfPresent("status");
m_sessionEndContext.log(cta::log::INFO, "Tape session finished");
m_sessionEndContext.clear();
// And record we do not have a process anymore.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment