Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.111
diff -u -F^f -r1.111 bootstrap.inc
--- includes/bootstrap.inc	7 Aug 2006 15:04:13 -0000	1.111
+++ includes/bootstrap.inc	9 Aug 2006 22:09:53 -0000
@@ -537,15 +537,18 @@ function request_uri() {
 function watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) {
   global $user, $base_root;
 
-  $current_db = db_set_active();
+  if ($severity >= variable_get('watchdog_level', WATCHDOG_NOTICE)) {
 
-  // Note: log the exact, entire absolute URL.
-  $request_uri = $base_root . request_uri();
+    $current_db = db_set_active();
 
-  db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, $request_uri, referer_uri(), $_SERVER['REMOTE_ADDR'], time());
+    // Note: log the exact, entire absolute URL.
+    $request_uri = $base_root . request_uri();
 
-  if ($current_db) {
-    db_set_active($current_db);
+    db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, $request_uri, referer_uri(), $_SERVER['REMOTE_ADDR'], time());
+
+    if ($current_db) {
+      db_set_active($current_db);
+    }
   }
 }
 
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.340
diff -u -F^f -r1.340 system.module
--- modules/system/system.module	9 Aug 2006 07:42:55 -0000	1.340
+++ modules/system/system.module	9 Aug 2006 22:09:54 -0000
@@ -547,6 +547,14 @@ function system_error_reporting_settings
     '#description' =>  t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
   );
 
+  $form['watchdog_level'] = array(
+    '#type' => 'select',
+    '#title' => t('Watchdog reporting level'),
+    '#default_value' => variable_get('watchdog_level', WATCHDOG_NOTICE),
+    '#options' => array(WATCHDOG_NOTICE => t('Notice'), WATCHDOG_WARNING => t('Warning'), WATCHDOG_ERROR => t('Error')),
+    '#description' => t('The amount of information logged by watchdog can be reduced by setting this to <code>Warning</code> or <code>Error</code>. This should be done if reducing the database load is more important than collecting log information.'),
+  );
+
   $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
   $period['1000000000'] = t('Never');
   $form['watchdog_clear'] = array(
