disable log forwarding by default - has issues at scale
[scpubgit/Object-Remote.git] / lib / Object / Remote / Logging.pm
index 58ccfb0..4571c0a 100644 (file)
@@ -74,22 +74,17 @@ sub init_logging {
   my %controller_should_log;
   
   unless (defined $ENV{OBJECT_REMOTE_LOG_FORWARDING} && $ENV{OBJECT_REMOTE_LOG_FORWARDING} ne '') {
-    $ENV{OBJECT_REMOTE_LOG_FORWARDING} = 1;
+    $ENV{OBJECT_REMOTE_LOG_FORWARDING} = 0;
   }
   
   if ($test_logging) {
     require Object::Remote::Logging::TestLogger;
-    router->connect(Object::Remote::Logging::TestOutput->new(
+    router->connect(Object::Remote::Logging::TestLogger->new(
       min_level => 'trace', max_level => 'error',
       level_names => Object::Remote::Logging->arg_levels(),
     ));
   }
 
-  return unless defined $level && $level ne '';
-  $format = "[%l %r] %s" unless defined $format;
-  $selections = __PACKAGE__ unless defined $selections;
-  %controller_should_log = _parse_selections($selections);
-
   {
     no warnings 'once';
     if (defined $Object::Remote::FatNode::REMOTE_NODE) {
@@ -99,6 +94,12 @@ sub init_logging {
     } 
   }
 
+  return unless defined $level && $level ne '';
+  
+  $format = "[%l %r] %s" unless defined $format;
+  $selections = __PACKAGE__ unless defined $selections;
+  %controller_should_log = _parse_selections($selections);
+
   my $logger = Object::Remote::Logging::Logger->new(
     min_level => lc($level), format => $format,
     level_names => Object::Remote::Logging::arg_levels(),
@@ -113,7 +114,7 @@ sub init_logging {
     return unless $will_log;
     #skip things from remote hosts because they log to STDERR
     #when OBJECT_REMOTE_LOG_LEVEL is in effect
-    return if $_[1]->{remote}->{connection_id};
+    return if $_[1]->{remote}->{object_remote};
     $logger
   });
 }
@@ -205,8 +206,8 @@ remote interpreter and the logger for the message is invoked in the local interp
 Sub-classes of Object::Remote::Logging will have log messages forwarded automatically.
 Loggers receive forwarded log messages exactly the same way as non-forwarded messages
 except a forwarded message includes extra metadata about the remote interpreter. Log
-forwarding is enabled by default but comes with a performance hit; to disable it set the 
-OBJECT_REMOTE_LOG_FORWARDING environment variable to 0. See L<Object::Remote::Logging::Router>.
+forwarding is disabled by default because it comes with a performance hit; to enable
+it set the OBJECT_REMOTE_LOG_FORWARDING environment variable to 1.
 
 =head1 EXPORTABLE SUBROUTINES