Blame SOURCES/0010-Make-log-output-disabled-by-default.patch

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