You can very easily create your own error logs.

my $errLog = qq[logs/errorLog.log];
open(STDERR, ">>$errLog")?&LogEntry(\*STDERR,"Opened error log $errLog"):die
("Could not open $errLog. Reason: $!");
my $number = 10;
$number eq 50?&LogEntry(\*STDERR,"$number equals
50."):&LogEntry(\*STDERR,"$number does not equal 50 you silly person.",$!);

#--------------------------------------------------#
# LogEntry is a subfunction that makes log entries.
#--------------------------------------------------#
sub LogEntry
{
my ($FH,$message,$error) = @_;
my $date = `date`;
chomp($date);
print $FH "Date: $date\nMessage: $message\nReason: $error\n&&\n" or
die("Could not make a log entry.\nReason:\n$!\n");
}   #end LogEntry


Use STDERR for your error log file handles so that you will catch all
errors.  Useful when your script runs with the "-w" switch.  Chomp the date
because the system date function returns a string with a "\n" on the end of
it.  The rest is just formatting.  If you use a consistent format for your
error logs, then you can build a viewer to view your logs.  Just something
that makes reading about errors easier.  Also with this kind of setup, you
can make entries for anything you want.  Notice I made a log entry right
away to let myself know that the error log was opened successfully.

HTH -
Peace In Christ -
Ron Goral
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>


-----Original Message-----
From: Elaine -HFB- Ashton [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 6:24 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Making my own error.logs


[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*>My new web hosting service at oneononeinternet.com doesn't have error logs
*>for each site. What do I do?
*>
*>Is there a way for me to create my own logs for my perl files?

You probably would benefit from buying
http://www.amazon.com/exec/obidos/ASIN/1565926471/

e.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to