1
0
Fork 0

added `--log.performance` startup option, removed `--log.severity` option

This commit is contained in:
Jan Steemann 2015-05-12 12:48:13 +02:00
parent 833978f9ae
commit 2e75255ea6
14 changed files with 91 additions and 184 deletions

View File

@ -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

View File

@ -29,10 +29,6 @@ Use *""* to disable.
<!-- lib/ApplicationServer/ApplicationServer.h -->
@startDocuBlock logRequests
!SUBSECTION Severity
<!-- lib/ApplicationServer/ApplicationServer.h -->
@startDocuBlock logSeverity
!SECTION Human Readable Logging
!SUBSECTION Level
@ -63,6 +59,10 @@ Use *""* to disable.
<!-- lib/ApplicationServer/ApplicationServer.h -->
@startDocuBlock logContentFilter
!SUBSECTION Performance
<!-- lib/ApplicationServer/ApplicationServer.h -->
@startDocuBlock logPerformance
!SECTION Machine Readable Logging
!SUBSECTION Application

View File

@ -19,4 +19,3 @@ v8-contexts = 1
[log]
level = info
severity = human

View File

@ -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

View File

@ -56,7 +56,6 @@ v8-contexts = 5
[log]
level = info
severity = human
file = @LOCALSTATEDIR@/log/arangodb/arangod.log
[cluster]

View File

@ -18,4 +18,3 @@ v8-contexts = 1
[log]
level = info
severity = human

View File

@ -19,7 +19,6 @@ v8-contexts = 5
[log]
level = info
severity = human
[cluster]
username = root

View File

@ -19,7 +19,6 @@ v8-contexts = 5
[log]
level = info
severity = human
[cluster]
username = root

View File

@ -18,7 +18,6 @@ v8-contexts = 5
[log]
level = info
severity = human
[cluster]
username = root

View File

@ -18,7 +18,6 @@ v8-contexts = 4
[log]
level = info
severity = human
[cluster]
username = root

View File

@ -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<string, ProgramOptionsDescription>& 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<string, ProgramOptionsDescription>& 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

View File

@ -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

View File

@ -275,36 +275,6 @@ static std::atomic<bool> 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
////////////////////////////////////////////////////////////////////////////////

View File

@ -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
// -----------------------------------------------------------------------------