Misc glog and gflags fixes.

Summary:
Log files aren't created by default anymore.
All logs are reported to stderr by default.
Normalized flag names.
Removed unnecessary flags from gflags.

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D856
This commit is contained in:
Matej Ferencevic 2017-10-04 16:20:38 +02:00
parent 1cd83d2c19
commit d249ff11a5
4 changed files with 13 additions and 11 deletions

View File

@ -138,11 +138,9 @@ import_external_library(gflags STATIC
-DGFLAGS_NO_FILENAMES=${GFLAGS_NO_FILENAMES})
# Setup google logging after gflags (so that glog can use it).
set(GLOG_NO_FILENAMES "0")
set(GLOG_NO_STACKTRACE "0")
set(GLOG_DISABLE_OPTIONS "0")
if ("${CMAKE_BUILD_TYPE}" MATCHES "^(R|r)(E|e)(L|l).+")
set(GLOG_NO_FILENAMES "1")
set(GLOG_NO_STACKTRACE "1")
set(GLOG_DISABLE_OPTIONS "1")
endif()
# Setup google logging after gflags (so that glog can use it).
@ -151,8 +149,9 @@ import_external_library(glog STATIC
${CMAKE_CURRENT_SOURCE_DIR}/glog/include
DEPENDS gflags-proj
CMAKE_ARGS -Dgflags_DIR=${CMAKE_CURRENT_SOURCE_DIR}/gflags/lib/cmake/gflags
-DGLOG_NO_FILENAMES=${GLOG_NO_FILENAMES}
-DGLOG_NO_STACKTRACE=${GLOG_NO_STACKTRACE})
-DGLOG_NO_FILENAMES=${GLOG_DISABLE_OPTIONS}
-DGLOG_NO_STACKTRACE=${GLOG_DISABLE_OPTIONS}
-DGLOG_NO_BUFFER_SETTINGS=${GLOG_DISABLE_OPTIONS})
# Setup cppitertools
import_header_library(cppitertools ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -67,7 +67,7 @@ cd ..
# google logging
git clone https://github.com/memgraph/glog.git
glog_tag="b5e33a7468cf7da6412eb50d1e8e704da471f49f" # custom version (v0.3.5+)
glog_tag="a6ee5ef590190cdb9f69cccc2db99dc5994b2f92" # custom version (v0.3.5+)
cd glog
git checkout ${glog_tag}
cd ..
@ -82,7 +82,7 @@ cd ..
# google flags
git clone https://github.com/memgraph/gflags.git
gflags_tag="69ce2926338522788d500e916736ef47e70dd905" # custom version (May 6, 2017)
gflags_tag="18c4a5d151f7828c62d838ef513b4db290e5324c" # custom version (May 6, 2017)
cd gflags
git checkout ${gflags_tag}
cd ..

View File

@ -37,8 +37,10 @@ DEFINE_string(port, "7687", "Communication port on which to listen.");
DEFINE_VALIDATED_int32(num_workers,
std::max(std::thread::hardware_concurrency(), 1U),
"Number of workers", FLAG_IN_RANGE(1, INT32_MAX));
DEFINE_string(log_file, "memgraph.log",
DEFINE_string(log_file, "",
"Path to where the log should be stored.");
DEFINE_string(log_link_basename, "",
"Basename used for symlink creation to the last log file.");
DEFINE_uint64(memory_warning_threshold, 1024,
"Memory warning treshold, in MB. If Memgraph detects there is "
"less available RAM available it will log a warning. Set to 0 to "
@ -70,7 +72,7 @@ void load_config(int &argc, char **&argv) {
for (const auto &config : configs)
if (fs::exists(config)) {
flagfile_arguments.emplace_back(
std::string("--flagfile=" + config.generic_string()));
std::string("--flag-file=" + config.generic_string()));
}
int custom_argc = static_cast<int>(flagfile_arguments.size()) + 1;
@ -101,6 +103,7 @@ int main(int argc, char **argv) {
google::InitGoogleLogging(argv[0]);
google::SetLogDestination(google::INFO, FLAGS_log_file.c_str());
google::SetLogSymlink(google::INFO, FLAGS_log_link_basename.c_str());
// Unhandled exception handler init.
std::set_terminate(&terminate_handler);

View File

@ -135,7 +135,7 @@ if not os.path.exists(args.memgraph):
cwd = os.path.dirname(args.memgraph)
cmd = [args.memgraph, "--num-workers=" + str(THREADS)]
if not args.verbose:
cmd += ["--minloglevel", "1"]
cmd += ["--min-log-level", "1"]
if args.log_file:
cmd += ["--log-file", args.log_file]
if args.snapshot_directory: