*** empty log message ***

svn path=/trunk/boinc/; revision=1773
This commit is contained in:
David Anderson 2003-07-22 20:52:25 +00:00
parent c7cf31a746
commit 5fc26034c5
3 changed files with 41 additions and 4 deletions

View File

@ -13,6 +13,7 @@
$f = $_GET["f"];
$s = $_GET["s"];
$l = (int)$_GET["l"];
if (!$f || !preg_match("/^ *([a-z_*]+[.](log|out) *)+$/", $f)) {
$f = '*.log';
@ -27,11 +28,12 @@
echo "<form action=show_log.php>";
echo " Regexp: <input name=s value='$s'>";
echo " Files: <input name=f value='$f'>";
echo " Lines: <input name=l value='$l'> (positive for head, negative for tail)";
echo " <input type=submit value=Grep></form>";
echo 'Hint: Example greps: "RESULT#106876", "26fe99aa_25636_00119.wu_1", "WU#8152", "too many errors", "2003-07-17", "CRITICAL" <br>';
passthru("cd $log_dir && ../bin/grep_logs -html '$s' $f 2>&1");
passthru("cd $log_dir && ../bin/grep_logs -html -l $l '$s' $f 2>&1 $lines");
page_tail();
} ?>

View File

@ -7,11 +7,16 @@ use strict;
use warnings;
my $html = 0;
my $lines = 0;
die unless @ARGV;
if ($ARGV[0] eq '-html') {
shift;
$html = 1;
}
if ($ARGV[0] eq '-l') {
shift;
$lines = shift;
}
my $s = shift; die unless defined $s;
@ -24,27 +29,57 @@ if ($s =~ /\d$/) {
my $prev_file = '';
my $nlines = 0;
my @slines = ();
sub printline($)
{
++$nlines;
if ($lines < 0) {
# tail - need to store all lines first
push(@slines, $_[0]);
} else {
return if ($lines > 0 && $nlines > $lines) ;
print $_[0];
}
};
sub finish_printlines()
{
if ($lines < 0) {
if (scalar(@slines) > -$lines) {
@slines = @slines[$#slines+$lines+1..$#slines];
}
print @slines;
}
$nlines = 0;
@slines = ();
}
if ($html) { print "<pre>"; }
while (<ARGV>) {
chomp;
if (/$s/) {
if ($ARGV ne $prev_file) {
finish_printlines();
$prev_file = $ARGV;
if ($html) {
print "</pre><h2>$ARGV</h2><pre>";
} else {
print "\n\n$ARGV:\n";
}
$nlines = 0;
}
my $n = sprintf("%05d", $.);
if ($html) {
s%.*debug.*%<font color=grey>$&</font>%i;
s%.*(critical|error).*%<font color=red>$&</font>%i;
s%$s%<b>$&</b>%g if $s;
print "<font size=-1><a name=$. href=show_log.php?f=$ARGV#$.>$n</a></font> $_\n";
printline "<font size=-1><a name=$. href=show_log.php?f=$ARGV#$.>$n</a></font> $_\n";
} else {
print " $n: $_\n";
printline " $n: $_\n";
}
}
}
finish_printlines();
if ($html) { print "</pre>"; }

View File

@ -48,7 +48,7 @@ static const char* STDERR_FILENAME = "../log/cgi.log";
#define REQ_FILE_PREFIX "boinc_req_"
#define REPLY_FILE_PREFIX "boinc_reply_"
bool use_files = true; // use disk files for req/reply msgs (for debugging)
bool use_files = false; // use disk files for req/reply msgs (for debugging)
DB_PROJECT gproject;
CONFIG config;