diff --git a/CHANGELOG b/CHANGELOG index d8271fe1c6..5e717e6eef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,11 @@ v2.6.0 (XXXX-XX-XX) ------------------- +* removed startup option `--log.severity` + +* added startup option `--log.performance`: specifying this option at startup will log + performance-related info messages, mainly timings via the regular logging mechanisms + * added optional `limit` parameter for AQL function `FULLTEXT` * make fulltext index also index text values that are contained in direct sub-objects of the indexed diff --git a/Documentation/Books/Users/ConfigureArango/Logging.mdpp b/Documentation/Books/Users/ConfigureArango/Logging.mdpp index 2f5b1930a1..6d86f22351 100644 --- a/Documentation/Books/Users/ConfigureArango/Logging.mdpp +++ b/Documentation/Books/Users/ConfigureArango/Logging.mdpp @@ -29,10 +29,6 @@ Use *""* to disable. @startDocuBlock logRequests -!SUBSECTION Severity - -@startDocuBlock logSeverity - !SECTION Human Readable Logging !SUBSECTION Level @@ -63,6 +59,10 @@ Use *""* to disable. @startDocuBlock logContentFilter +!SUBSECTION Performance + +@startDocuBlock logPerformance + !SECTION Machine Readable Logging !SUBSECTION Application diff --git a/etc/arangodb/arango-dfdb.conf.in b/etc/arangodb/arango-dfdb.conf.in index 67917016b2..9c472fe511 100644 --- a/etc/arangodb/arango-dfdb.conf.in +++ b/etc/arangodb/arango-dfdb.conf.in @@ -19,4 +19,3 @@ v8-contexts = 1 [log] level = info -severity = human diff --git a/etc/arangodb/arangod-docker.conf.in b/etc/arangodb/arangod-docker.conf.in index 3535691f68..78a9b1a192 100644 --- a/etc/arangodb/arangod-docker.conf.in +++ b/etc/arangodb/arangod-docker.conf.in @@ -66,7 +66,6 @@ v8-contexts = 5 [log] level = info -severity = human # We don't follow LHFS for docker, since the logs directory will be mounted # flat to the top of the container: file = /logs/arangodb.log diff --git a/etc/arangodb/arangod.conf.in b/etc/arangodb/arangod.conf.in index 8421e99c56..e5e6990a1e 100644 --- a/etc/arangodb/arangod.conf.in +++ b/etc/arangodb/arangod.conf.in @@ -56,7 +56,6 @@ v8-contexts = 5 [log] level = info -severity = human file = @LOCALSTATEDIR@/log/arangodb/arangod.log [cluster] diff --git a/etc/relative/arango-dfdb.conf b/etc/relative/arango-dfdb.conf index 9853dd781e..e6c8554748 100644 --- a/etc/relative/arango-dfdb.conf +++ b/etc/relative/arango-dfdb.conf @@ -18,4 +18,3 @@ v8-contexts = 1 [log] level = info -severity = human diff --git a/etc/relative/arangod-coordinator.conf b/etc/relative/arangod-coordinator.conf index cfa0d835e8..0f448f4082 100644 --- a/etc/relative/arangod-coordinator.conf +++ b/etc/relative/arangod-coordinator.conf @@ -19,7 +19,6 @@ v8-contexts = 5 [log] level = info -severity = human [cluster] username = root diff --git a/etc/relative/arangod-dbserver.conf b/etc/relative/arangod-dbserver.conf index cfa0d835e8..0f448f4082 100644 --- a/etc/relative/arangod-dbserver.conf +++ b/etc/relative/arangod-dbserver.conf @@ -19,7 +19,6 @@ v8-contexts = 5 [log] level = info -severity = human [cluster] username = root diff --git a/etc/relative/arangod.conf b/etc/relative/arangod.conf index 8bc2d8d2c5..70bbfee7fd 100644 --- a/etc/relative/arangod.conf +++ b/etc/relative/arangod.conf @@ -18,7 +18,6 @@ v8-contexts = 5 [log] level = info -severity = human [cluster] username = root diff --git a/etc/relative/dispatcher.conf b/etc/relative/dispatcher.conf index 4399c60746..d32c6a28be 100644 --- a/etc/relative/dispatcher.conf +++ b/etc/relative/dispatcher.conf @@ -18,7 +18,6 @@ v8-contexts = 4 [log] level = info -severity = human [cluster] username = root diff --git a/lib/ApplicationServer/ApplicationServer.cpp b/lib/ApplicationServer/ApplicationServer.cpp index 2793e641f3..8eb56ffb73 100644 --- a/lib/ApplicationServer/ApplicationServer.cpp +++ b/lib/ApplicationServer/ApplicationServer.cpp @@ -107,7 +107,6 @@ ApplicationServer::ApplicationServer (std::string const& name, std::string const _logApplicationName("arangod"), _logFacility(""), _logLevel("info"), - _logSeverity("human"), _logFile("+"), _logTty("+"), _logRequestsFile(""), @@ -181,6 +180,8 @@ void ApplicationServer::setupLogging (bool threaded, bool daemon, bool backgroun TRI_ShutdownLogging(false); TRI_InitialiseLogging(threaded); + std::string severity("human"); + if (_options.has("log.thread")) { _logThreadId = true; } @@ -193,16 +194,20 @@ void ApplicationServer::setupLogging (bool threaded, bool daemon, bool backgroun _logLocalTime = true; } + if (_options.has("log.performance")) { + severity += ",performance"; + } + if (! _logRequestsFile.empty()) { // add this so the user does not need to think about it - _logSeverity += ",usage"; + severity += ",usage"; } TRI_SetUseLocalTimeLogging(_logLocalTime); TRI_SetLineNumberLogging(_logLineNumber); TRI_SetLogLevelLogging(_logLevel.c_str()); - TRI_SetLogSeverityLogging(_logSeverity.c_str()); + TRI_SetLogSeverityLogging(severity.c_str()); TRI_SetPrefixLogging(_logPrefix.c_str()); TRI_SetThreadIdentifierLogging(_logThreadId); @@ -795,8 +800,8 @@ void ApplicationServer::setupOptions (map& op ("log.source-filter", &_logSourceFilter, "only debug and trace messages emitted by specific C source file") ("log.content-filter", &_logContentFilter, "only log message containing the specified string (case-sensitive)") ("log.line-number", "always log file and line number") + ("log.performance", "log performance indicators") ("log.prefix", &_logPrefix, "prefix log") - ("log.severity", &_logSeverity, "log severities") ("log.thread", "log the thread identifier for severity 'human'") ("log.use-local-time", "use local dates and times in log messages") ("log.tty", &_logTty, "additional log file if started on tty") @@ -806,6 +811,7 @@ void ApplicationServer::setupOptions (map& op ("log", &_logLevel, "log level for severity 'human'") ("log.syslog", &DeprecatedParameter, "use syslog facility (deprecated)") ("log.hostname", &DeprecatedParameter, "host name for syslog") + ("log.severity", &DeprecatedParameter, "log severities") #ifdef TRI_HAVE_SETUID ("uid", &_uid, "switch to user-id after reading config files") #endif diff --git a/lib/ApplicationServer/ApplicationServer.h b/lib/ApplicationServer/ApplicationServer.h index 364ad33bc3..4c6555acd9 100644 --- a/lib/ApplicationServer/ApplicationServer.h +++ b/lib/ApplicationServer/ApplicationServer.h @@ -599,28 +599,6 @@ namespace triagens { std::string _logLevel; -//////////////////////////////////////////////////////////////////////////////// -/// @brief log severity -/// @startDocuBlock logSeverity -/// `--log.severity severity` -/// -/// This parameter provides a set of standard log severities which can be -/// used. The currently accepted *severities* are: -/// -/// - exception -/// - technical -/// - functional -/// - development -/// - human -/// - all (human and non-human) -/// - non-human (exception, technical, functional, and development) -/// -/// The default is all. -/// @endDocuBlock -//////////////////////////////////////////////////////////////////////////////// - - std::string _logSeverity; - //////////////////////////////////////////////////////////////////////////////// /// @brief log file /// @startDocuBlock logFile @@ -753,6 +731,17 @@ namespace triagens { std::string _logContentFilter; +//////////////////////////////////////////////////////////////////////////////// +/// @brief performance logging +/// @startDocuBlock logPerformance +/// `--log.performance` +/// +/// If this option is set, performance-related info messages will be logged via +/// the regular logging mechanism. These will consist of mostly timing and +/// debugging information for performance-critical operations. +/// @endDocuBlock +//////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// /// @brief random number generator to use /// @startDocuBlock randomGenerator diff --git a/lib/Basics/logging.cpp b/lib/Basics/logging.cpp index 2ef7525ce3..80ccd90b81 100644 --- a/lib/Basics/logging.cpp +++ b/lib/Basics/logging.cpp @@ -275,36 +275,6 @@ static std::atomic LoggingThreadActive(false); static sig_atomic_t IsUsage = 0; -//////////////////////////////////////////////////////////////////////////////// -/// @brief human readable logging -//////////////////////////////////////////////////////////////////////////////// - -static sig_atomic_t IsHuman = 1; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief exception readable logging -//////////////////////////////////////////////////////////////////////////////// - -static sig_atomic_t IsException = 1; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief technical readable logging -//////////////////////////////////////////////////////////////////////////////// - -static sig_atomic_t IsTechnical = 1; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief functional readable logging -//////////////////////////////////////////////////////////////////////////////// - -static sig_atomic_t IsFunctional = 1; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief development readable logging -//////////////////////////////////////////////////////////////////////////////// - -static sig_atomic_t IsDevelopment = 1; - //////////////////////////////////////////////////////////////////////////////// /// @brief log fatal messages //////////////////////////////////////////////////////////////////////////////// @@ -341,6 +311,12 @@ static sig_atomic_t IsDebug = 0; static sig_atomic_t IsTrace = 0; +//////////////////////////////////////////////////////////////////////////////// +/// @brief log performance messages +//////////////////////////////////////////////////////////////////////////////// + +static sig_atomic_t IsPerformance = 0; + //////////////////////////////////////////////////////////////////////////////// /// @brief use local time for dates & times in log output //////////////////////////////////////////////////////////////////////////////// @@ -1058,12 +1034,8 @@ void TRI_SetLogLevelLogging (char const* level) { //////////////////////////////////////////////////////////////////////////////// void TRI_SetLogSeverityLogging (char const* severities) { - IsException = 0; - IsTechnical = 0; - IsFunctional = 0; - IsDevelopment = 0; IsUsage = 0; - IsHuman = 0; + IsPerformance = 0; TRI_vector_string_t split = TRI_SplitString(severities, ','); size_t const n = split._length; @@ -1071,38 +1043,11 @@ void TRI_SetLogSeverityLogging (char const* severities) { for (size_t i = 0; i < n; ++i) { char const* type = split._buffer[i]; - if (TRI_CaseEqualString(type, "exception")) { - IsException = 1; - } - else if (TRI_CaseEqualString(type, "technical")) { - IsTechnical = 1; - } - else if (TRI_CaseEqualString(type, "functional")) { - IsFunctional = 1; - } - else if (TRI_CaseEqualString(type, "development")) { - IsDevelopment = 1; - } - else if (TRI_CaseEqualString(type, "usage")) { + if (TRI_CaseEqualString(type, "usage")) { IsUsage = 1; } - else if (TRI_CaseEqualString(type, "human")) { - IsHuman = 1; - } - else if (TRI_CaseEqualString(type, "all")) { - IsException = 1; - IsTechnical = 1; - IsFunctional = 1; - IsDevelopment = 1; - IsUsage = 1; - IsHuman = 1; - } - else if (TRI_CaseEqualString(type, "non-human")) { - IsException = 1; - IsTechnical = 1; - IsFunctional = 1; - IsDevelopment = 1; - IsUsage = 1; + else if (TRI_CaseEqualString(type, "performance")) { + IsPerformance = 1; } } @@ -1176,46 +1121,6 @@ bool TRI_IsUsageLogging () { return IsUsage != 0; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if human logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsHumanLogging () { - return IsHuman != 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if exception logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsExceptionLogging () { - return IsException != 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if technical logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsTechnicalLogging () { - return IsTechnical != 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if functional logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsFunctionalLogging () { - return IsFunctional != 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if development logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsDevelopmentLogging () { - return IsDevelopment != 0; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief checks if fatal logging is enabled //////////////////////////////////////////////////////////////////////////////// @@ -1291,6 +1196,14 @@ bool TRI_IsTraceLogging (char const* file) { } } +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if performance logging is enabled +//////////////////////////////////////////////////////////////////////////////// + +bool TRI_IsPerformanceLogging () { + return IsInfo != 0 && IsPerformance != 0; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief logs a new message //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Basics/logging.h b/lib/Basics/logging.h index a53955075f..28d54fc934 100644 --- a/lib/Basics/logging.h +++ b/lib/Basics/logging.h @@ -145,61 +145,31 @@ void TRI_SetFileToLog (char const* file); /// @brief checks if usage logging is enabled //////////////////////////////////////////////////////////////////////////////// -bool TRI_IsUsageLogging (void); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if human logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsHumanLogging (void); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if exception logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsExceptionLogging (void); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if technical logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsTechnicalLogging (void); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if functional logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsFunctionalLogging (void); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if development logging is enabled -//////////////////////////////////////////////////////////////////////////////// - -bool TRI_IsDevelopmentLogging (void); +bool TRI_IsUsageLogging (); //////////////////////////////////////////////////////////////////////////////// /// @brief checks if fatal logging is enabled //////////////////////////////////////////////////////////////////////////////// -bool TRI_IsFatalLogging (void); +bool TRI_IsFatalLogging (); //////////////////////////////////////////////////////////////////////////////// /// @brief checks if error logging is enabled //////////////////////////////////////////////////////////////////////////////// -bool TRI_IsErrorLogging (void); +bool TRI_IsErrorLogging (); //////////////////////////////////////////////////////////////////////////////// /// @brief checks if warning logging is enabled //////////////////////////////////////////////////////////////////////////////// -bool TRI_IsWarningLogging (void); +bool TRI_IsWarningLogging (); //////////////////////////////////////////////////////////////////////////////// /// @brief checks if info logging is enabled //////////////////////////////////////////////////////////////////////////////// -bool TRI_IsInfoLogging (void); +bool TRI_IsInfoLogging (); //////////////////////////////////////////////////////////////////////////////// /// @brief checks if debug logging is enabled @@ -213,6 +183,12 @@ bool TRI_IsDebugLogging (char const*); bool TRI_IsTraceLogging (char const*); +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if performance logging is enabled +//////////////////////////////////////////////////////////////////////////////// + +bool TRI_IsPerformanceLogging (); + //////////////////////////////////////////////////////////////////////////////// /// @brief logs a new message //////////////////////////////////////////////////////////////////////////////// @@ -267,7 +243,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_FATAL_AND_EXIT(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__); \ - if (TRI_IsHumanLogging() && TRI_IsFatalLogging()) { \ + if (TRI_IsFatalLogging()) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_FATAL, \ TRI_LOG_SEVERITY_HUMAN, \ @@ -304,7 +280,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_ERROR(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__); \ - if (TRI_IsHumanLogging() && TRI_IsErrorLogging()) { \ + if (TRI_IsErrorLogging()) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_ERROR, \ TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ @@ -328,7 +304,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_WARNING(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__) \ - if (TRI_IsHumanLogging() && TRI_IsWarningLogging()) { \ + if (TRI_IsWarningLogging()) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_WARNING, \ TRI_LOG_SEVERITY_HUMAN, \ @@ -353,7 +329,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_INFO(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__); \ - if (TRI_IsHumanLogging() && TRI_IsInfoLogging()) { \ + if (TRI_IsInfoLogging()) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_INFO, \ TRI_LOG_SEVERITY_HUMAN, \ @@ -378,7 +354,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_DEBUG(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__); \ - if (TRI_IsHumanLogging() && TRI_IsDebugLogging(__FILE__)) { \ + if (TRI_IsDebugLogging(__FILE__)) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_DEBUG, \ TRI_LOG_SEVERITY_HUMAN, \ @@ -401,7 +377,7 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #define LOG_TRACE(...) \ do { \ LOG_ARG_CHECK(__VA_ARGS__); \ - if (TRI_IsHumanLogging() && TRI_IsTraceLogging(__FILE__)) { \ + if (TRI_IsTraceLogging(__FILE__)) { \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ TRI_LOG_LEVEL_TRACE, \ TRI_LOG_SEVERITY_HUMAN, \ @@ -440,6 +416,32 @@ void CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR (void); #endif +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs performance messages +//////////////////////////////////////////////////////////////////////////////// + +#undef LOG_PERFORMANCE + +#ifdef TRI_ENABLE_LOGGER + +#define LOG_PERFORMANCE(...) \ + do { \ + LOG_ARG_CHECK(__VA_ARGS__); \ + if (TRI_IsPerformanceLogging()) { \ + TRI_Log(__FUNCTION__, __FILE__, __LINE__, \ + TRI_LOG_LEVEL_INFO, \ + TRI_LOG_SEVERITY_HUMAN, \ + __VA_ARGS__); \ + } \ + } while (0) + +#else + +#define LOG_INFO(...) while (0) + +#endif + + // ----------------------------------------------------------------------------- // --SECTION-- LOG APPENDER // -----------------------------------------------------------------------------