R: [PHP3] Displaying Log Files in Browser Window
| From: | Bruno | Date: | Mon, 22 May 2000 14:18:23 +0000 |
| Subject: | R: [PHP3] Displaying Log Files in Browser Window | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf <rasmus@php.net> wrote in message
Pine.LNX.4.21.0005220649100.15390-100000@thinkpad.php.net...
> Personally I'd just do:
>
> <PRE>
> <?system("tail -500 /apache/logs/error_log")?>
> </PRE>
>
> -Rasmus
>
> On Mon, 22 May 2000, Graham Pearson wrote:
>
> > Group:
> >
> > I have been using php for the past 4 months and have come from the Cold
> > Fusion Realm. I just finished my first website with php/mysql/apache and
> > now onto my second application.
> >
> > Here is my code that I have come up with and what I am trying to do, is
to
> > display the apache log file in a browser window that has each line in
the
> > log file on a new line of the browser. I understand that these log files
> > can be very long, and want only to display the last 500 - 1000 lines of
the
> > file.
> >
> > Any Ideas on where I can go with this?
> >
> >
> > <?php
> > $NumberOfCharactersToDisplay = 500;
> > if (!$ApacheErrorLogFopen = fopen
("/d1s0/apache/logs/error_log",
> > "r-")) {
> > Print ("Unable to open /d1s0/apache/logs/error_log");
> > }
> >
> > if (!$ApacheErrorLogFile = file
("/d1s0/apache/logs/error_log")) {
> > Print ("Unable to open /d1s0/apache/logs/error_log");
> > }
> >
> > $ApacheErrorLogStartingPosition = filesize
> > ("/d1s0/apache/logs/error_log") - $NumberOfCharactersToDisplay;
> > $ApacheErrorLogSeekFopen = fseek ( $ApacheErrorLogFopen,
> > $ApacheErrorLogStartingPosition);
> > $ApacheErrorLogPositionFopen = ftell($ApacheErrorLogFopen);
> > $DisplayApacheErrorLogTestFopen =
fpassthru($ApacheErrorLogFopen);
> >
> > $ApacheErrorLogSeekFile = fseek ($ApacheErrorLogFile,
> > $ApacheErrorLogStartingPosition);
> >
> > // $DisplayApacheErrorLog = fread ($ApacheErrorLog,
> > $NumberOfCharactersToDisplay);
> >
> > Print ("<BR>Apache Error Log Value: $ApacheErrorLog");
> > Print ("<BR>ApacheErrorLogStartingPosition Value:
> > $ApacheErrorLogStartingPosition");
> > Print ("<BR>ApacheErrorLogSeek: $ApacheErrorLogSeek");
> > Print ("<BR>ApacheErrorLogPosition: $ApacheErrorLogPosition");
> >
> > Print ("<BR>$DisplayApacheErrorLogTest");
> >
> >
> > --
> > Get Paid to Surf the Net -- The Rules have changed
> > Http://www.alladvantage.com/home.asp?refid=EOW694
> >
> > ================================================================
> > Graham Pearson, Technology Support Center Supervisor
> > Northern Indiana Educational Services Center
> > Http://support.niesc.k12.in.us Voice (219) 254-0111 Fax: (219)
254-0148
> >
> > Email: gpearson@support.niesc.k12.in.us
> >
> >
> >
>
>
> --
> PHP 3 Mailing List <http://www.php.net/>
> To unsubscribe, send an empty message to php3-unsubscribe@lists.php.net
> To subscribe to the digest, e-mail: php3-digest-subscribe@lists.php.net
> To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>