From 6f4c2c6d88956b282ce5992f87c86995de5a774f Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Tue, 29 Oct 2013 17:47:48 +0100 Subject: [PATCH 10/39] Make log output disabled by default Related to rhbz#1023081 Related to rhbz#1055581 Signed-off-by: Jakub Filak --- README | 6 +----- src/abrt-checker.c | 7 ++++++- test/CMakeLists.txt | 9 +++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README b/README index 28cefda..abbed4f 100644 --- a/README +++ b/README @@ -33,7 +33,7 @@ $ java -agentlib:abrt-java-connector=abrt=on $MyClass -platform.jvmtiSupported Example3: - this example shows how to configure the log output destination - output option is designed for this purpose -- by default abrt-java-connector prints the log to abrt_checker_$PID.log file in the current directory +- abrt-java-connector does not print any logs by default - the first command prints logs to /tmp/abrt_checker_$PID.log $ java -agentlib:abrt-java-connector=output=/tmp $MyClass -platform.jvmtiSupported true @@ -42,10 +42,6 @@ $ java -agentlib:abrt-java-connector=output=/tmp $MyClass -platform.jvmtiSuppor $ java -agentlib:abrt-java-connector=output=/tmp/abrt-agent.log $MyClass -platform.jvmtiSupported true -- the thirs command completely disables logging to file - -$ java -agentlib:abrt-java-connector=output= $MyClass -platform.jvmtiSupported true - Example4: - this example shows how to enable reporting of caught exceptions diff --git a/src/abrt-checker.c b/src/abrt-checker.c index c403d00..3eac971 100644 --- a/src/abrt-checker.c +++ b/src/abrt-checker.c @@ -194,7 +194,7 @@ T_processProperties processProperties; T_errorDestination reportErrosTo; /* Path (not necessary absolute) to output file */ -char *outputFileName; +char *outputFileName = DISABLED_LOG_OUTPUT; /* Path (not necessary absolute) to output file */ char **reportedCaughExceptionTypes; @@ -2604,6 +2604,11 @@ void parse_commandline_options(char *options) } else if(strcmp("output", key) == 0) { + if (DISABLED_LOG_OUTPUT != outputFileName) + { + free(outputFileName); + } + if (value == NULL || value[0] == '\0') { VERBOSE_PRINT("Disabling output to log file\n"); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4e0d836..f322e9f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -266,5 +266,14 @@ add_custom_target( ) add_test(test_log_file_in_directory make run_log_file_in_directory) +add_custom_target( + run_default_no_log_file + COMMAND LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src ${Java_JAVA_EXECUTABLE} -agentlib:${AGENT_NAME} Test || test -z "`find -name abrt_checker_*.log`" + DEPENDS AbrtChecker ${TEST_JAVA_TARGETS} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +add_test(test_default_no_log_file make run_default_no_log_file) + + get_directory_property(all_run_targets ALL_RUN_TARGETS) add_custom_target(run_all DEPENDS ${all_run_targets}) -- 1.8.3.1