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

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