[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.102, Thu May 8 22:52:30 2008 UTC revision 1.103, Fri May 9 04:21:45 2008 UTC
# Line 670  Line 670 
670  destination of C<WARN> indicates that the caller is running as a web  destination of C<WARN> indicates that the caller is running as a web
671  service in a production environment; however, this is not a requirement.  service in a production environment; however, this is not a requirement.
672    
673    To force warnings into the RSS feed even when the tracing destination
674    is not C<WARN>, simply specify the C<Feed> tracing module. This can be
675    configured automatically when L</StandardSetup> is used.
676    
677  The L</Cluck> method calls this one for its final message. Since  The L</Cluck> method calls this one for its final message. Since
678  L</Confess> calls L</Cluck>, this means that any error which is caught  L</Confess> calls L</Cluck>, this means that any error which is caught
679  and confessed will put something in the feed. This insures that someone  and confessed will put something in the feed. This insures that someone
# Line 690  Line 694 
694      my ($message) = @_;      my ($message) = @_;
695      # Trace the message.      # Trace the message.
696      Trace($message);      Trace($message);
697      # Check for debug mode.      # Check for feed forcing.
698      my $debugMode = (exists $Categories{feed} && $TraceLevel > 0);      my $forceFeed = exists $Categories{feed};
699      # An error here would be disastrous. Note, however, that we aren't too worried      # An error here would be disastrous. Note, however, that we aren't too worried
700      # about losing events. The error log is always available for the occasions where      # about losing events. The error log is always available for the occasions where
701      # we mess up. Note that if debug mode is specified, we do this stuff even in a      # we mess up. Note that if debug mode is specified, we do this stuff even in a
702      # test environment.      # test environment.
703      eval {      eval {
704          # Do we need to put this in the RSS feed?          # Do we need to put this in the RSS feed?
705          if ($FIG_Config::error_feed && ($Destination eq 'WARN' || $debugMode)) {          if ($FIG_Config::error_feed && ($Destination eq 'WARN' || $forceFeed)) {
706              # Yes. We now need to compute the date, the link, and the title.              # Yes. We now need to compute the date, the link, and the title.
707              # First, the date, in a very specific format.              # First, the date, in a very specific format.
708              my $date = strftime("%a, %02e %b %H:%M:%S %Y ", localtime) .              my $date = strftime("%a, %02e %b %H:%M:%S %Y ", localtime) .
709                  (tz_local_offset() / 30);                  (tz_local_offset() / 30);
             Trace("Generating RSS feed. Date = $date.") if $debugMode;  
710              # Environment data goes in here. We start with the date.              # Environment data goes in here. We start with the date.
711              my $environment = "$date.  ";              my $environment = "$date.  ";
712              # If we need to recap the message (because it's too long to be a title), we'll              # If we need to recap the message (because it's too long to be a title), we'll
# Line 763  Line 766 
766              # our <br>s and <pre>s are used to format the description.              # our <br>s and <pre>s are used to format the description.
767              $recap = (defined $recap ? "<em>" . CGI::escapeHTML($recap) . "</em><br /><br />" : "");              $recap = (defined $recap ? "<em>" . CGI::escapeHTML($recap) . "</em><br /><br />" : "");
768              my $description = "$recap$environment  $stackTrace";              my $description = "$recap$environment  $stackTrace";
             Trace("Unescaped description is:\n$description") if $debugMode;  
769              # Okay, we have all the pieces. Create a hash of the new event.              # Okay, we have all the pieces. Create a hash of the new event.
770              my $newItem = { title => $title,              my $newItem = { title => $title,
771                              description => $description,                              description => $description,
# Line 820  Line 822 
822              }              }
823          }          }
824      };      };
825      # We only worry about problems in debug mode. The loss of an error message is an annoyance, not a      if ($@) {
826      # crisis.          # If the feed failed, we need to know why. The error will be traced, but this method will not be involved
827      if ($@ && $debugMode) {          # (which is a good thing).
828          my $error = $@;          my $error = $@;
829          Trace("Feed Error: $error");          Trace("Feed Error: $error") if T(Feed => 0);
830      }      }
831  }  }
832    
# Line 1656  Line 1658 
1658  Specifying a value of C<E> for the trace level causes emergency tracing to  Specifying a value of C<E> for the trace level causes emergency tracing to
1659  be used instead of custom tracing. If the user name is not specified,  be used instead of custom tracing. If the user name is not specified,
1660  the tracing key is taken from the C<Tracing> environment variable. If there  the tracing key is taken from the C<Tracing> environment variable. If there
1661  is no value for that variable, the tracing key will be computed from the PID.  is no value for that variable, the tracing key will be computed from the active
1662    login ID.
1663    
1664    Since the default situation in StandardSetup is to trace to the standard
1665    output, errors that occur in command-line scripts will not generate
1666    RSS events. To force the events, use the C<warn> option.
1667    
1668        TransactFeatures -background -warn register ../xacts IDs.tbl
1669    
1670  Finally, if the special option C<-help> is specified, the option  Finally, if the special option C<-help> is specified, the option
1671  names will be traced at level 0 and the program will exit without processing.  names will be traced at level 0 and the program will exit without processing.
# Line 1744  Line 1753 
1753      $options->{help} = [0, "display command-line options"];      $options->{help} = [0, "display command-line options"];
1754      $options->{user} = [$tkey, "tracing key"];      $options->{user} = [$tkey, "tracing key"];
1755      $options->{background} = [0, "spool standard and error output"];      $options->{background} = [0, "spool standard and error output"];
1756        $options->{warn} = [0, "send errors to RSS feed"];
1757      # Create a parsing hash from the options hash. The parsing hash      # Create a parsing hash from the options hash. The parsing hash
1758      # contains the default values rather than the default value      # contains the default values rather than the default value
1759      # and the description. While we're at it, we'll memorize the      # and the description. While we're at it, we'll memorize the
# Line 1782  Line 1792 
1792          if ($retOptions->{sql}) {          if ($retOptions->{sql}) {
1793              push @cats, "SQL";              push @cats, "SQL";
1794          }          }
1795            if ($retOptions->{warn}) {
1796                push @cats, "Feed";
1797            }
1798          # Add the default categories.          # Add the default categories.
1799          push @cats, "Tracer";          push @cats, "Tracer";
1800          # Next, we create the category string by joining the categories.          # Next, we create the category string by joining the categories.

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.103

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3