mirror of https://gitee.com/bigwinds/arangodb
issue #122: arangod doesn't start if <log.file> cannot be created
This commit is contained in:
parent
f7be68bd47
commit
d9227ac680
|
@ -241,7 +241,14 @@ void ApplicationServer::setupLogging () {
|
|||
TRI_SetFileToLog(i->c_str());
|
||||
}
|
||||
|
||||
TRI_CreateLogAppenderFile(_logFile);
|
||||
if (NULL == TRI_CreateLogAppenderFile(_logFile)) {
|
||||
if (_logFile.length() > 0) {
|
||||
// the user specified a log file to use but it could not be created. bail out
|
||||
std::cerr << "failed to create logfile " << _logFile << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
}
|
||||
}
|
||||
TRI_CreateLogAppenderSyslog(_logPrefix, _logSyslog);
|
||||
|
||||
#ifdef TRI_HAVE_SETGID
|
||||
|
|
|
@ -1347,6 +1347,11 @@ TRI_log_appender_t* TRI_CreateLogAppenderFile (char const* filename) {
|
|||
|
||||
// allocate space
|
||||
appender = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(log_appender_file_t), false);
|
||||
if (appender == NULL) {
|
||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// logging to stdout
|
||||
if (TRI_EqualString(filename, "+")) {
|
||||
|
@ -1372,6 +1377,12 @@ TRI_log_appender_t* TRI_CreateLogAppenderFile (char const* filename) {
|
|||
TRI_SetCloseOnExecFile(appender->_fd);
|
||||
|
||||
appender->_filename = TRI_DuplicateString(filename);
|
||||
if (appender->_filename == NULL) {
|
||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, appender);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// set methods
|
||||
|
|
Loading…
Reference in New Issue