diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2015-09-14 14:01:25 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-09-14 15:41:10 +0000 |
commit | 159ee3fd7c7243990f525b37467298a36f8ee462 (patch) | |
tree | b10b2b2fac08f82a4cb18d37347968d930bafa6b /src/main | |
parent | 4b67d4fed1f4ca8e4b1dd7dce47061b6b3779860 (diff) |
Configured Java logging for Bazel
Previously the logger output was sent out to the console,
leading to garbage information in batch mode. Now, the log
are sent to a log file in the output base.
--
MOS_MIGRATED_REVID=102989990
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/cpp/blaze_startup_options.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main/cpp/blaze_startup_options.cc b/src/main/cpp/blaze_startup_options.cc index 05d4d390b8..1a4ecb8405 100644 --- a/src/main/cpp/blaze_startup_options.cc +++ b/src/main/cpp/blaze_startup_options.cc @@ -142,8 +142,23 @@ string BlazeStartupOptions::GetJvm() { blaze_exit_code::ExitCode BlazeStartupOptions::AddJVMArguments( const string &host_javabase, vector<string> *result, const vector<string> &user_options, string *error) const { - // TODO(bazel-team): see what tuning options make sense in the - // open-source world. + // Configure logging + const string propFile = output_base + "/javalog.properties"; + if (!WriteFile( + "handlers=java.util.logging.FileHandler\n" + ".level=INFO\n" + "java.util.logging.FileHandler.level=INFO\n" + "java.util.logging.FileHandler.pattern=" + + output_base + "/java.log\n" + "java.util.logging.FileHandler.limit=50000\n" + "java.util.logging.FileHandler.count=1\n" + "java.util.logging.FileHandler.formatter=" + "java.util.logging.SimpleFormatter\n", + propFile)) { + perror(("Couldn't write logging file " + propFile).c_str()); + } else { + result->push_back("-Djava.util.logging.config.file=" + propFile); + } return blaze_exit_code::SUCCESS; } |