Skip to content

Commit

Permalink
Remove --logfile and -l parameters
Browse files Browse the repository at this point in the history
As there is no need to use --logfile anymore (use syslog functionality instead)
and to force the update of old startup scripts that use -l (also for logfile),
these command-line parameters have been removed.
  • Loading branch information
Beirdo committed Mar 6, 2012
1 parent a9bf1d3 commit fd1800a
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Expand Up @@ -2243,7 +2243,7 @@ void MythCommandLineParser::addUPnP(void)
}

/** \brief Canned argument definition for all logging options, including
* --verbose, --logfile, --logpath, --quiet, --loglevel, --syslog
* --verbose, --logpath, --quiet, --loglevel, --syslog
* and --nodblog
*/
void MythCommandLineParser::addLogging(
Expand All @@ -2264,16 +2264,13 @@ void MythCommandLineParser::addLogging(
"This option takes an unsigned value corresponding "
"to the bitwise log verbosity operator.")
->SetGroup("Logging");
add(QStringList( QStringList() << "-l" << "--logfile" << "--logpath" ),
"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.date.pid.log.\n"
"If a full filename is given, that file will be used.\n"
add("--logpath", "logpath", "",
"Writes logging messages to a file in the directory logpath with "
"filenames in the format: applicationName.date.pid.log.\n"
"This is typically used in combination with --daemon, and if used "
"in combination with --pidfile, this can be used with log "
"rotators, using the HUP call to inform MythTV to reload the "
"file (currently disabled).", "")
"file", "")
->SetGroup("Logging");
add(QStringList( QStringList() << "-q" << "--quiet"), "quiet", 0,
"Don't log to the console (-q). Don't log anywhere (-q -q)", "")
Expand Down Expand Up @@ -2301,7 +2298,7 @@ void MythCommandLineParser::addPIDFile(void)
"Write PID of application to filename.",
"Write the PID of the currently running process as a single "
"line to this file. Used for init scripts to know what "
"process to terminate, and with --logfile and log rotators "
"process to terminate, and with log rotators "
"to send a HUP signal to process to have it re-open files.");
}

Expand All @@ -2324,8 +2321,7 @@ void MythCommandLineParser::addInFile(bool addOutFile)
add("--outfile", "outfile", "", "Output file URI", "");
}

/** \brief Helper utility for logging interface to pull path to log file
* from --logfile, or generate one from --logpath
/** \brief Helper utility for logging interface to pull path from --logpath
*/
QString MythCommandLineParser::GetLogFilePath(void)
{
Expand All @@ -2339,21 +2335,19 @@ QString MythCommandLineParser::GetLogFilePath(void)
QString filepath;

QFileInfo finfo(logfile);
if (finfo.isDir())
if (!finfo.isDir())
{
SetValue("islogpath", true);
logdir = finfo.filePath();
logfile = QCoreApplication::applicationName() + "." +
QDateTime::currentDateTime().toString("yyyyMMddhhmmss") +
QString(".%1").arg(pid) + ".log";
}
else
{
SetValue("islogpath", false);
logdir = finfo.path();
logfile = finfo.fileName();
LOG(VB_GENERAL, LOG_ERR,
QString("%1 is not a directory, disabling logfiles")
.arg(logfile));
return QString();
}

logdir = finfo.filePath();
logfile = QCoreApplication::applicationName() + "." +
QDateTime::currentDateTime().toString("yyyyMMddhhmmss") +
QString(".%1").arg(pid) + ".log";

SetValue("logdir", logdir);
SetValue("logfile", logfile);
SetValue("filepath", QFileInfo(QDir(logdir), logfile).filePath());
Expand Down Expand Up @@ -2455,7 +2449,7 @@ int MythCommandLineParser::ConfigureLogging(QString mask, unsigned int progress)
QString("Enabled verbose msgs: %1").arg(verboseString));

QString logfile = GetLogFilePath();
bool propagate = toBool("islogpath");
bool propagate = !logfile.isEmpty();

if (toBool("daemon"))
quiet = max(quiet, 1);
Expand Down

0 comments on commit fd1800a

Please sign in to comment.