Skip to content

Commit

Permalink
Changed default logfile name to include date
Browse files Browse the repository at this point in the history
To make the logs sort naturally in chronological order, the default logfile
name is now:  applicationname.date.pid.log with the date in the format
yyyyMMddhhmmss.  This should make wrangling the logs a lot simpler.
  • Loading branch information
Beirdo committed Jul 11, 2011
1 parent cc0c711 commit 4c6babd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Expand Up @@ -22,6 +22,7 @@ using namespace std;
#include <QString>
#include <QCoreApplication>
#include <QTextStream>
#include <QDateTime>

#include "mythcommandlineparser.h"
#include "mythcorecontext.h"
Expand Down Expand Up @@ -959,7 +960,7 @@ void MythCommandLineParser::addLogging(void)
"logpath", "",
"Writes logging messages to a file at logpath.\n"
"If a directory is given, a logfile will be created in that "
"directory with a filename of applicationName.pid.log.\n"
"directory with a filename of applicationName.date.pid.log.\n"
"If a full filename is given, that file will be used.\n"
"This is typically used in combination with --daemon, and if used "
"in combination with --pidfile, this can be used with log "
Expand Down Expand Up @@ -1012,7 +1013,8 @@ QString MythCommandLineParser::GetLogFilePath(void)
{
m_parsed.insert("islogpath", true);
logdir = finfo.filePath();
logfile = QCoreApplication::applicationName() +
logfile = QCoreApplication::applicationName() + "." +
QDateTime::currentDateTime().toString("yyyyMMddhhmmss") +
QString(".%1").arg(pid) + ".log";
}
else
Expand Down

0 comments on commit 4c6babd

Please sign in to comment.