Commit 23138803 authored by Eric Cano's avatar Eric Cano
Browse files

Added missing clearing of session log params.

The logs parameters strcuture is reused for several session in the main process.
They are now cleared after the last log for a given session.
parent 8bdd3a92
......@@ -46,6 +46,10 @@ void LogContext::erase(const std::string& paramName) throw() {
m_params.erase(std::remove_if(m_params.begin(), m_params.end(), match), m_params.end());
}
void LogContext::clear() {
m_params.clear();
}
void LogContext::log(const int priority, const std::string& msg) throw() {
m_log(priority, msg, m_params);
}
......
......@@ -66,6 +66,12 @@ public:
*/
void erase(const std::string & paramName) throw();
/**
* Clears the context content.
*/
void clear();
/**
* Writes a message into the CASTOR logging system. Note that no exception
* will ever be thrown in case of failure. Failures will actually be
......
......@@ -228,6 +228,7 @@ void DriveHandler::kill() {
m_sessionEndContext.pushOrReplace({"killSignal", WTERMSIG(status)});
m_sessionEndContext.pushOrReplace({"status", "failure"});
m_sessionEndContext.log(cta::log::INFO, "Tape session finished");
m_sessionEndContext.clear();
} catch (exception::Exception & ex) {
params.add("Exception", ex.getMessageValue());
m_processManager.logContext().log(log::ERR, "In DriveHandler::kill(): failed to kill existing subprocess");
......@@ -728,6 +729,7 @@ SubprocessHandler::ProcessingStatus DriveHandler::processSigChild() {
}
// In all cases we log the end of the session.
m_sessionEndContext.log(cta::log::INFO, "Tape session finished");
m_sessionEndContext.clear();
return m_processingStatus;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment