diff --git a/common/log/FileLogger.cpp b/common/log/FileLogger.cpp index a99f6e5e7630ed3ae2a57f9258bdb6a5f98d8cd9..6cc7e92807dd483cb76b8066e5e83809f885bde4 100644 --- a/common/log/FileLogger.cpp +++ b/common/log/FileLogger.cpp @@ -60,7 +60,7 @@ void FileLogger::reducedSyslog(const std::string & msg) { if (-1 == m_fd) throw cta::exception::Exception("In FileLogger::reducedSyslog(): file is not properly initialized"); // Prepare the string to print (for size) - std::string m = msg.substr(0, m_maxMsgLen); + std::string m = msg.substr(0, m_maxMsgLen) + "\n"; // enter critical section threading::MutexLocker lock(m_mutex); diff --git a/common/log/FileLogger.hpp b/common/log/FileLogger.hpp index 9737226579465bce615850711ce14bb02d2c54da..14e36a8ee8b2f154b21be04113c828cede4565e6 100644 --- a/common/log/FileLogger.hpp +++ b/common/log/FileLogger.hpp @@ -70,7 +70,9 @@ protected: /** * A reduced version of syslog. This method is able to set the message * timestamp. This is necessary when logging messages asynchronously of there - * creation, such as when retrieving logs from the DB. + * creation, such as when retrieving logs from the DB. This function truncates + * the message if necessary. It also adds a new line at the end of the message + * if needed. * * @param msg The message to be logged. */ diff --git a/common/log/Logger.cpp b/common/log/Logger.cpp index 5247f576c06dfc9a3c743c0c44df36f236e04ff6..4021a901bad92d5f31724d2af1bd623bfb0e6b86 100644 --- a/common/log/Logger.cpp +++ b/common/log/Logger.cpp @@ -153,9 +153,6 @@ void Logger::writeLogMsg( // Append raw parameters os << rawParams; - - // Terminate the string - os << "\n"; } //----------------------------------------------------------------------------- diff --git a/common/log/StdoutLogger.cpp b/common/log/StdoutLogger.cpp index bb19cc0eac32fe583aa52fa68a42b3ea4bad2601..5cb46251ee94f43520002bbe0e7eccc607cf2d1c 100644 --- a/common/log/StdoutLogger.cpp +++ b/common/log/StdoutLogger.cpp @@ -43,7 +43,7 @@ void StdoutLogger::prepareForFork() {} // reducedSyslog //------------------------------------------------------------------------------ void StdoutLogger::reducedSyslog(const std::string & msg) { - printf("%s", msg.c_str()); + printf("%s\n", msg.c_str()); } } // namespace log