diff --git a/debian/man/guhd.1 b/debian/man/guhd.1 index eddbfbaa..24766f80 100644 --- a/debian/man/guhd.1 +++ b/debian/man/guhd.1 @@ -1,6 +1,6 @@ .\" Manpage for guhd. .\" Contact simon.stuerz@guh.io to correct errors or typos. -.TH man 1 "March 2017" "1.8" "guhd man page" +.TH man 1 "February 2018" "1.9" "guhd man page" .SH NAME guhd \- An open source IoT (Internet of Things) server .SH SYNOPSIS @@ -23,8 +23,16 @@ Displays version information. Run guhd in the foreground, not as daemon. .TP \fB\-p\fR, \fB\-\-print\-all\fR -Enables all debug categories. This parameter overrides all debug -category parameters. +Enables all debug categories. Single debug categories can be disabled again +with -d parameter. +.TP +\fB\-l\fR, \fB\-\-log\fR +Specify a log file to write to, if this option is not specified, +logs will be printed to the standard output. +.TP +\fB\-\-session\fR +If specified, all D-Bus interfaces will be bound to the session bus +instead of the system bus. .TP \fB\-d\fR, \fB\-\-debug\fR, \fB\<[No\]DebugCategory>\fR Debug categories to enable. In order to disable a category which is enabled by @@ -33,36 +41,64 @@ categories will be printed unless they are explicitly muted with "NoWarnings". .RS .TP \fBMain\ debug\ categories:\fR +.IP \fIAWS\fR\ (default\ disabled) +Print the debug messages from the AWS connection. +.IP \fIAWSTraffic\fR\ (default\ disabled) +Print the debug messages from the AWS connection traffic. .IP \fIApplication\fR\ (default\ enabled) Print the debug messages from the core application. .IP \fIAvahi\fR\ (default\ disabled) Print the debug messages from the avahi resource. +.IP \fIBluetooth\fR\ (default\ disabled) +Print the debug messages from the bluetooth resource. .IP \fICloud\fR\ (default\ enabled) Print the debug messages from the Cloud connections in guh. +.IP \fICoap\fR\ (default\ disabled) +Print the debug messages from the COaP resource. .IP \fIConnection\fR\ (default\ enabled) Print the debug messages from the TCP connections in guh. .IP \fIDeviceManager\fR\ (default\ enabled) Print the debug messages from the device manager. .IP \fIHardware\fR\ (default\ disabled) Print the debug messages from hardware resources in guh. +.IP \fIJanus\fR\ (default\ disabled) +Print the debug messages from the janus connection. +.IP \fIJanusTraffic\fR\ (default\ disabled) +Print the debug messages from the janus connection traffic. .IP \fIJsonRpc\fR\ (default\ disabled) Print the debug messages from JSON-RPC API. +.IP \fIJsonRpcTraffic\fR\ (default\ disabled) +Print the debug messages from JSON-RPC API traffic. .IP \fILogEngine\fR\ (default\ disabled) Print the debug messages from logging engine. +.IP \fINetworkManager\fR\ (default\ disabled) +Print the debug messages from network manager. .IP \fIOAuth2\fR\ (default\ disabled) Print the debug messages of the OAuth2 resource. .IP \fIRest\fR\ (default\ disabled) Print the debug messages from REST API. .IP \fIRuleEngine\fR\ (default\ enabled) Print the debug messages from the rule engine. +.IP \fIRuleEngineDebug\fR\ (default\ disabled) +Print the debug messages from the rule engine with more details. .IP \fITcpServer\fR\ (default\ disabled) Print the debug messages from the TCP server. +.IP \fITcpServerTraffic\fR\ (default\ disabled) +Print the debug messages from the TCP server traffic. +.IP \fITimeManager\fR\ (default\ disabled) +Print the debug messages from the time manager. +.IP \fIUPnP\fR\ (default\ disabled) +Print the debug messages from the UPnP resource. +.IP \fIUserManager\fR\ (default\ enabled) +Print the debug messages from the user manager. .IP \fIWarning\fR\ (default\ enabled) Print warnings. .IP \fIWebServer\fR\ (default\ disabled) Print the debug messages from the web server. .IP \fIWebSocketServer\fR\ (default\ disabled) Print the debug messages from the websocket server. +.IP \fIWebSocketServerTraffic\fR\ (default\ disabled) +Print the debug messages from the websocket server traffic. .TP \fBDebug\ categories\ for\ plugins:\fR Since guh loads the plugins dynamically, the list of supported @@ -77,6 +113,10 @@ $ guhd -n -d Hardware To start guhd in the foreground, disable debug messages from the DeviceManager and enable debug messages for JsonRpc and LogEngine: .IP $ guhd -n -d NoDeviceManager -d JsonRpc -d LogEngine +.TP +To start guhd in the foreground, enable all debug messages except WebSocketServerTraffic and TcpServerTraffic: +.IP +$ guhd -n -p -d NoWebSocketServerTraffic -d NoTcpServerTraffic .SH FILES The server config file: \fI/etc/guh/guhd.conf\fR .br @@ -88,8 +128,6 @@ The plugins config file: \fI/etc/guh/plugins.conf\fR .br The log file: \fI/var/log/guhd.log\fR .br -The logrotate config file: \fI/etc/logrotate.d/guhd\fR -.br The logging database: \fI/var/log/guhd.sqlite\fR .br The systemd unit file: \fI/lib/systemd/system/guhd.service\fR @@ -106,7 +144,7 @@ How to report bugs: .SH AUTHOR Written by Simon Stürz and Michael Zanetti .SH COPYRIGHT -Copyright \(co 2014-2017 guh GmbH. +Copyright \(co 2014-2018 guh GmbH. .br License GPLv2: GNU GPL version 2 . diff --git a/libguh-core/debugserverhandler.cpp b/libguh-core/debugserverhandler.cpp index ba5c1634..4643daef 100644 --- a/libguh-core/debugserverhandler.cpp +++ b/libguh-core/debugserverhandler.cpp @@ -60,12 +60,13 @@ QByteArray DebugServerHandler::createDebugXmlDocument() // Welcome section writer.writeTextElement("h1", QCoreApplication::translate("main", "nymea debug interface")); writer.writeEmptyElement("hr"); - writer.writeTextElement("p", QCoreApplication::translate("main", "Welcome to the debug interface. This debug interface was designed to provide an easy possibility to get helpful information about the running nymea server. This interfaces provides read only options and is disabled by default.")); + writer.writeTextElement("p", QCoreApplication::translate("main", "Welcome to the debug interface.")); + writer.writeTextElement("p", QCoreApplication::translate("main", "This debug interface was designed to provide an easy possibility to get helpful information about the running nymea server.")); writer.writeEmptyElement("hr"); writer.writeTextElement("h3", QCoreApplication::translate("main", "Warning")); - writer.writeTextElement("p", QCoreApplication::translate("main", "Be aware that this debug interface is a security breach and offers access to the system log and therefore to possibly sensible data. If you are not using the debug tools, than you should disable this debug server.")); - writer.writeTextElement("p", QCoreApplication::translate("main", "The debug server can be disabled by changing the the value \"debugServerEnabled=false\" in the \"guhd\" section of %1 or using the API method \"Configuration.SetDebugServerEnabled\".").arg(GuhSettings(GuhSettings::SettingsRoleGlobal).fileName())); + writer.writeTextElement("p", QCoreApplication::translate("main", "Be aware that this debug interface is a security breach and offers access to the system log and therefore to possibly sensible data.")); + writer.writeTextElement("p", QCoreApplication::translate("main", "If you are not using this debug tools, than you should disable it.")); writer.writeEmptyElement("hr"); // System information section @@ -73,7 +74,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeEmptyElement("hr"); writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); + //writer.writeAttribute("width", "100%"); writer.writeAttribute("border", "1"); writer.writeStartElement("col"); @@ -81,7 +82,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeEndElement(); // col writer.writeStartElement("col"); - writer.writeAttribute("align", "right"); + writer.writeAttribute("align", "left"); writer.writeEndElement(); // col QString userName = qgetenv("USER"); @@ -175,7 +176,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("tr"); writer.writeTextElement("th", QCoreApplication::translate("main", "Settings path")); - writer.writeTextElement("td", GuhSettings(GuhSettings::SettingsRoleGlobal).settingsPath()); + writer.writeTextElement("td", GuhSettings::settingsPath()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); @@ -197,7 +198,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() } else { writer.writeTextElement("th", ""); } - writer.writeTextElement("td", GuhCore::instance()->deviceManager()->pluginSearchDirs().at(i)); + writer.writeTextElement("td", QFileInfo(GuhCore::instance()->deviceManager()->pluginSearchDirs().at(i)).absoluteFilePath()); } writer.writeEndElement(); // table @@ -212,6 +213,8 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeTextElement("h3", QCoreApplication::translate("main", "Logs")); writer.writeStartElement("table"); + writer.writeAttribute("border", "1"); + writer.writeStartElement("tr"); writer.writeTextElement("th", QCoreApplication::translate("main", "Log database")); @@ -250,6 +253,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeTextElement("h3", QCoreApplication::translate("main", "Settings")); writer.writeStartElement("table"); + writer.writeAttribute("border", "1"); writer.writeStartElement("tr"); writer.writeTextElement("th", QCoreApplication::translate("main", "Guhd settings")); diff --git a/libguh-core/guhconfiguration.cpp b/libguh-core/guhconfiguration.cpp index f86959f7..8c58d330 100644 --- a/libguh-core/guhconfiguration.cpp +++ b/libguh-core/guhconfiguration.cpp @@ -398,11 +398,13 @@ bool GuhConfiguration::debugServerEnabled() const void GuhConfiguration::setDebugServerEnabled(bool enabled) { qCDebug(dcApplication()) << "Configuration: Set debug server" << (enabled ? "enabled" : "disabled"); - if (debugServerEnabled() != enabled) { - GuhSettings settings(GuhSettings::SettingsRoleGlobal); - settings.beginGroup("guhd"); - settings.setValue("debugServerEnabled", enabled); - settings.endGroup(); + bool currentValue = debugServerEnabled(); + GuhSettings settings(GuhSettings::SettingsRoleGlobal); + settings.beginGroup("guhd"); + settings.setValue("debugServerEnabled", enabled); + settings.endGroup(); + + if (currentValue != enabled) { emit debugServerEnabledChanged(enabled); } } diff --git a/server/main.cpp b/server/main.cpp index f24e4909..23dde4c1 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) "device available in the system and create individual scenes and behaviors \n" "for your environment.\n\n"); - applicationDescription.append(QString("guhd %1 %2 2014-2017 guh GmbH\n" + applicationDescription.append(QString("guhd %1 %2 2014-2018 guh GmbH\n" "Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n" "API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION)); @@ -193,15 +193,16 @@ int main(int argc, char *argv[]) QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. This parameter overrides all debug category parameters.")); parser.addOption(allOption); - QCommandLineOption debugOption(QStringList() << "d" << "debug-category", debugDescription, "[No]DebugCategory"); - parser.addOption(debugOption); - QCommandLineOption logOption({"l", "log"}, QCoreApplication::translate("main", "Specify a log file to write to, If this option is not specified, logs will be printed to the standard output."), "logfile", "/var/log/guhd.log"); + QCommandLineOption logOption({"l", "log"}, QCoreApplication::translate("main", "Specify a log file to write to, if this option is not specified, logs will be printed to the standard output."), "logfile", "/var/log/guhd.log"); parser.addOption(logOption); QCommandLineOption dbusOption(QStringList() << "session", QCoreApplication::translate("main", "If specified, all D-Bus interfaces will be bound to the session bus instead of the system bus.")); parser.addOption(dbusOption); + QCommandLineOption debugOption(QStringList() << "d" << "debug-category", debugDescription, "[No]DebugCategory"); + parser.addOption(debugOption); + parser.process(application); // Open the logfile, if any specified diff --git a/tests/auto/configurations/testconfigurations.cpp b/tests/auto/configurations/testconfigurations.cpp index 19e32042..b0d8493e 100644 --- a/tests/auto/configurations/testconfigurations.cpp +++ b/tests/auto/configurations/testconfigurations.cpp @@ -326,7 +326,7 @@ void TestConfigurations::testDebugServerConfiguration() verifyConfigurationError(response); // Check notification not emitted - notificationSpy.wait(500); + notificationSpy.wait(); configurationChangedNotifications = checkNotifications(notificationSpy, "Configuration.BasicConfigurationChanged"); QVariantMap notificationContent = configurationChangedNotifications.first().toMap().value("params").toMap(); QVERIFY2(notificationContent.contains("basicConfiguration"), "Notification does not contain basicConfiguration"); @@ -372,8 +372,6 @@ void TestConfigurations::testDebugServerConfiguration() namSpy.wait(); QVERIFY2(namSpy.count() > 0, "expected response from webserver"); - qDebug() << reply->readAll(); - bool ok = false; int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&ok); QVERIFY2(ok, "Could not convert statuscode from response to int");