diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp index d0e8eb2e0d..aafb9db5a2 100644 --- a/assignment-client/src/AssignmentClientApp.cpp +++ b/assignment-client/src/AssignmentClientApp.cpp @@ -129,7 +129,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : // We want to configure the logging system as early as possible auto &logHandler = LogHandler::getInstance(); if (parser.isSet(logOption)) { - if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) { + if (!logHandler.parseOptions(parser.value(logOption).toUtf8(), logOption.names().first())) { QCoreApplication mockApp(argc, const_cast(argv)); // required for call to showHelp() parser.showHelp(); Q_UNREACHABLE(); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 0cf99c8d05..719ffa71dc 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -442,7 +442,7 @@ void DomainServer::parseCommandLine(int argc, char* argv[]) { // We want to configure the logging system as early as possible auto &logHandler = LogHandler::getInstance(); if (parser.isSet(logOption)) { - if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) { + if (!logHandler.parseOptions(parser.value(logOption).toUtf8(), logOption.names().first())) { QCoreApplication mockApp(argc, const_cast(argv)); // required for call to showHelp() parser.showHelp(); Q_UNREACHABLE(); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 4bc0d7743a..640789c282 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -311,7 +311,7 @@ int main(int argc, const char* argv[]) { // We want to configure the logging system as early as possible auto &logHandler = LogHandler::getInstance(); if (parser.isSet(logOption)) { - if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) { + if (!logHandler.parseOptions(parser.value(logOption).toUtf8(), logOption.names().first())) { QCoreApplication mockApp(argc, const_cast(argv)); // required for call to showHelp() parser.showHelp(); Q_UNREACHABLE(); diff --git a/libraries/shared/src/LogHandler.cpp b/libraries/shared/src/LogHandler.cpp index 2197c49dc4..e04a036b1a 100644 --- a/libraries/shared/src/LogHandler.cpp +++ b/libraries/shared/src/LogHandler.cpp @@ -61,7 +61,7 @@ LogHandler::LogHandler() { _useJournald = true; #endif - parseOptions(logOptions); + parseOptions(logOptions, "VIRCADIA_LOG_OPTIONS"); } const char* stringForLogType(LogMsgType msgType) { @@ -121,7 +121,7 @@ const QString DATE_STRING_FORMAT = "MM/dd hh:mm:ss"; // the following will produce 11/18 13:55:36.999 const QString DATE_STRING_FORMAT_WITH_MILLISECONDS = "MM/dd hh:mm:ss.zzz"; -bool LogHandler::parseOptions(QString logOptions) { +bool LogHandler::parseOptions(const QString& logOptions, const QString& paramName) { QMutexLocker lock(&_mutex); auto optionList = logOptions.split(","); @@ -145,7 +145,7 @@ bool LogHandler::parseOptions(QString logOptions) { } else if (option == "nojournald") { _useJournald = false; } else if (option != "") { - fprintf(stdout, "Unrecognized option in VIRCADIA_LOG_OPTIONS: '%s'\n", option.toUtf8().constData()); + fprintf(stderr, "Unrecognized option in %s: '%s'\n", paramName.toUtf8().constData(), option.toUtf8().constData()); return false; } } diff --git a/libraries/shared/src/LogHandler.h b/libraries/shared/src/LogHandler.h index 81ef0aff03..e64f8e29c3 100644 --- a/libraries/shared/src/LogHandler.h +++ b/libraries/shared/src/LogHandler.h @@ -53,10 +53,11 @@ public: * This parses the logging settings in the environment variable, or from the commandline * * @param options Option list + * @param paramName Name of the log option, for error reporting. * @return true Option list was parsed successfully * @return false There was an error */ - bool parseOptions(QString options); + bool parseOptions(const QString& options, const QString ¶mName); /** * @brief Set the name of the component that's producing log output