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

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