diff --git a/config/global.ini.php b/config/global.ini.php
index 910423ef34c53abf0ca1b5d487566ce468b28df8..d35a627939953f93fc27feaa6984a902b4e62719 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -47,7 +47,7 @@ always_archive_data_range = 0;
 
 ; if set to 1, all the SQL queries will be recorded by the profiler 
 ; and a profiling summary will be printed at the end of the request
-; NOTE: you must also set  [log]logger_message[] = "screen" to enable the profiler to print on screen 
+; NOTE: you must also set  [log] logger_message[] = "screen" to enable the profiler to print on screen 
 enable_sql_profiler = 0
 
 ; if set to 1, a Piwik tracking code will be included in the Piwik UI footer and will track visits, pages, etc. to idsite = 1
@@ -342,6 +342,14 @@ encryption =						; SMTP transport-layer encryption, either 'ssl', 'tls', or emp
 logger_error[]			= screen
 logger_exception[]		= screen
 
+; if set to 1, only requests done in CLI mode (eg. the archive.sh cron run) will be logged
+; NOTE: log_only_when_debug_parameter will also be checked for
+log_only_when_cli = 0
+
+; if set to 1, only requests with "&debug" parameter will be logged
+; NOTE: log_only_when_cli will also be checked for
+log_only_when_debug_parameter = 0
+
 ; if configured to log in files, log files will be created in this path
 ; eg. if the value is tmp/logs files will be created in /path/to/piwik/tmp/logs/
 logger_file_path		= tmp/logs
diff --git a/core/Log.php b/core/Log.php
index 008bdd37d6a76a015815ad51f87e5fa587cb7107..6d198a476613ad54f7a81584f3c2f0887f092094 100644
--- a/core/Log.php
+++ b/core/Log.php
@@ -49,11 +49,6 @@ abstract class Piwik_Log extends Zend_Log
 		$this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 	}
 	
-	static public function dump($var)
-	{
-		Zend_Registry::get('logger_message')->logEvent(var_export($var, true));
-	}
-	
 	function addWriteToFile()
 	{
 		Piwik_Common::mkdir(dirname($this->logToFileFilename));
diff --git a/core/Piwik.php b/core/Piwik.php
index 7637d481cdd760767a1f257db76e155aea276a98..82cf223ad14aa6ba8d787c3cfc6f28a3661e7daf 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -892,7 +892,20 @@ class Piwik
 	 */
 	static public function log($message = '')
 	{
-		Zend_Registry::get('logger_message')->logEvent($message);
+		static $shouldLog = null;
+		if(is_null($shouldLog))
+		{
+			$shouldLog = (Piwik_Common::isPhpCliMode()
+							|| Zend_Registry::get('config')->log->log_only_when_cli == 0)
+						&& 
+						  ( Zend_Registry::get('config')->log->log_only_when_debug_parameter == 0
+						  	|| isset($_REQUEST['debug']))
+						;
+		}
+		if($shouldLog)
+		{
+			Zend_Registry::get('logger_message')->logEvent($message);
+		}
 	}
 
 	/**