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

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