mirror of https://gitee.com/bigwinds/arangodb
fixed syslog
This commit is contained in:
parent
2dcd5f7486
commit
ec37174083
|
@ -1,6 +1,11 @@
|
|||
v2.4.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* fixed syslog flags. `--log.syslog` is deprecated and setting it has no effect,
|
||||
`--log.facility` now works as described. Application name has been changed from
|
||||
`triagens` to `arangod`. It can be changed using `--log.application`. The syslog
|
||||
will only contain the actual log message. The datetime prefix is omiited.
|
||||
|
||||
* fixed deflate in SimpleHttpClient
|
||||
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@ statistics about executed requests and timings about computation steps.
|
|||
<!-- lib/ApplicationServer/ApplicationServer.h -->
|
||||
@startDocuBlock logSeverity
|
||||
|
||||
!SUBSECTION Syslog
|
||||
<!-- lib/ApplicationServer/ApplicationServer.h -->
|
||||
@startDocuBlock logSyslog
|
||||
|
||||
!SECTION Human Readable Logging
|
||||
|
||||
!SUBSECTION Level
|
||||
|
@ -62,7 +58,3 @@ statistics about executed requests and timings about computation steps.
|
|||
!SUBSECTION Facility
|
||||
<!-- lib/ApplicationServer/ApplicationServer.h -->
|
||||
@startDocuBlock logFacility
|
||||
|
||||
!SUBSECTION Histname
|
||||
<!-- lib/ApplicationServer/ApplicationServer.h -->
|
||||
@startDocuBlock logHostname
|
||||
|
|
|
@ -53,6 +53,8 @@ using namespace triagens::basics;
|
|||
using namespace triagens::rest;
|
||||
using namespace std;
|
||||
|
||||
static string DeprecatedParameter;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public constants
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -118,15 +120,13 @@ ApplicationServer::ApplicationServer (std::string const& name, std::string const
|
|||
_gid(),
|
||||
_realGid(0),
|
||||
_effectiveGid(0),
|
||||
_logApplicationName("triagens"),
|
||||
_logHostName("-"),
|
||||
_logFacility("-"),
|
||||
_logApplicationName("arangod"),
|
||||
_logFacility(""),
|
||||
_logLevel("info"),
|
||||
_logSeverity("human"),
|
||||
_logFile("+"),
|
||||
_logRequestsFile(""),
|
||||
_logPrefix(),
|
||||
_logSyslog(),
|
||||
_logThreadId(false),
|
||||
_logLineNumber(false),
|
||||
_logLocalTime(false),
|
||||
|
@ -159,15 +159,13 @@ ApplicationServer::ApplicationServer (std::string const& name, std::string const
|
|||
_gid(),
|
||||
_realGid(0),
|
||||
_effectiveGid(0),
|
||||
_logApplicationName("triagens"),
|
||||
_logHostName("-"),
|
||||
_logFacility("-"),
|
||||
_logApplicationName("arangod"),
|
||||
_logFacility(""),
|
||||
_logLevel("info"),
|
||||
_logSeverity("human"),
|
||||
_logFile("+"),
|
||||
_logRequestsFile(""),
|
||||
_logPrefix(),
|
||||
_logSyslog(),
|
||||
_logThreadId(false),
|
||||
_logLineNumber(false),
|
||||
_logLocalTime(false),
|
||||
|
@ -308,7 +306,7 @@ void ApplicationServer::setupLogging (bool threaded, bool daemon) {
|
|||
}
|
||||
|
||||
#ifdef TRI_ENABLE_SYSLOG
|
||||
if (_logSyslog != "") {
|
||||
if (! _logFacility.empty()) {
|
||||
TRI_CreateLogAppenderSyslog(_logApplicationName.c_str(),
|
||||
_logFacility.c_str(),
|
||||
contentFilter,
|
||||
|
@ -818,20 +816,20 @@ void ApplicationServer::setupOptions (map<string, ProgramOptionsDescription>& op
|
|||
|
||||
options[OPTIONS_LOGGER + ":help-log"]
|
||||
("log.application", &_logApplicationName, "application name for syslog")
|
||||
("log.facility", &_logFacility, "facility name for syslog")
|
||||
("log.facility", &_logFacility, "facility name for syslog (OS dependent)")
|
||||
("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.hostname", &_logHostName, "host name for syslog")
|
||||
("log.line-number", "always log file and line number")
|
||||
("log.prefix", &_logPrefix, "prefix log")
|
||||
("log.severity", &_logSeverity, "log severities")
|
||||
("log.syslog", &_logSyslog, "use syslog facility")
|
||||
("log.thread", "log the thread identifier for severity 'human'")
|
||||
("log.use-local-time", "use local dates and times in log messages")
|
||||
;
|
||||
|
||||
options[OPTIONS_HIDDEN]
|
||||
("log", &_logLevel, "log level for severity 'human'")
|
||||
("log.syslog", &DeprecatedParameter, "use syslog facility (deprecated)")
|
||||
("log.hostname", &DeprecatedParameter, "host name for syslog")
|
||||
#ifdef TRI_HAVE_SETUID
|
||||
("uid", &_uid, "switch to user-id after reading config files")
|
||||
#endif
|
||||
|
|
|
@ -522,26 +522,23 @@ namespace triagens {
|
|||
|
||||
std::string _logApplicationName;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief log host name
|
||||
/// @startDocuBlock logHostname
|
||||
/// `--log.hostname name`
|
||||
///
|
||||
/// Specifies the *name* of the operating environment (the "hostname") which
|
||||
/// should be logged if this item of information is to be logged. Note that
|
||||
/// there is no default hostname.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string _logHostName;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief log facility
|
||||
/// @startDocuBlock logFacility
|
||||
/// `--log.facility name`
|
||||
///
|
||||
/// Specifies the name of the server instance which should be logged if this
|
||||
/// item of information is to be logged.
|
||||
/// If this option is set, then in addition to output being directed to the
|
||||
/// standard output (or to a specified file, in the case that the command line
|
||||
/// log.file option was set), log output is also sent to the system logging
|
||||
/// facility. The *arg* is the system log facility to use. See syslog for
|
||||
/// further details.
|
||||
///
|
||||
/// The value of *arg* depends on your syslog configuration. In general it
|
||||
/// will be *user*. Fatal messages are mapped to *crit*, so if *arg*
|
||||
/// is *user*, these messages will be logged as *user.crit*. Error
|
||||
/// messages are mapped to *err*. Warnings are mapped to *warn*. Info
|
||||
/// messages are mapped to *notice*. Debug messages are mapped to
|
||||
/// *info*. Trace messages are mapped to *debug*.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -709,28 +706,6 @@ namespace triagens {
|
|||
|
||||
std::string _logPrefix;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief log level
|
||||
/// @startDocuBlock logSyslog
|
||||
/// `--log.syslog arg`
|
||||
///
|
||||
/// If this option is set, then in addition to output being directed to the
|
||||
/// standard output (or to a specified file, in the case that the command line
|
||||
/// log.file option was set), log output is also sent to the system logging
|
||||
/// facility. The *arg* is the system log facility to use. See syslog for
|
||||
/// further details.
|
||||
///
|
||||
/// The value of *arg* depends on your syslog configuration. In general it
|
||||
/// will be *user*. Fatal messages are mapped to *crit*, so if *arg*
|
||||
/// is *user*, these messages will be logged as *user.crit*. Error
|
||||
/// messages are mapped to *err*. Warnings are mapped to *warn*. Info
|
||||
/// messages are mapped to *notice*. Debug messages are mapped to
|
||||
/// *info*. Trace messages are mapped to *debug*.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string _logSyslog;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief log thread identifier
|
||||
/// @startDocuBlock logThread
|
||||
|
|
|
@ -1746,8 +1746,17 @@ static void LogAppenderSyslog_Log (TRI_log_appender_t* appender,
|
|||
|
||||
self = (log_appender_syslog_t*) appender;
|
||||
|
||||
char const* ptr = strchr(msg, ']');
|
||||
|
||||
if (ptr == nullptr) {
|
||||
ptr = msg;
|
||||
}
|
||||
else if (ptr[1] != '\0') {
|
||||
ptr += 2;
|
||||
}
|
||||
|
||||
TRI_LockMutex(&self->_mutex);
|
||||
syslog(priority, "%s", msg);
|
||||
syslog(priority, "%s", ptr);
|
||||
TRI_UnlockMutex(&self->_mutex);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue