I've never really considered adding to the system logs because they tend to fill up rapidly, get aged, and deleted. Many times system logs are also located on partitions that are relatively short on space, so I don't want to aggravate that problem either.
I prefer creating application specific log files that are human readable at all times, so I try to use messages that are visually distinctive for the various types of logged messages. As I'm debugging I comment out debug statements from areas as I complete them so the amount of information logged decreases greatly as I near the end of a project. The parts left are usually checkpoints that indicate success or failure of a given task.
When debugging some web applications sometimes I find it more helpful to bypass file logging and generate simple javascript alerts:
For more extensive web debugging info I use a html sub that is passed a "Continue" value that can be used to halt execution if necessary:print "<script language='javascript'>alert('Exiting sub XXXXXXXXXX.')< +/script>";
Yes, I realize that I could take better advantage of CGI.pm, and I probably will rewrite this sub to do so when I undertake my next Web application (which may not be for several months).sub Notify { my ($Text, $continue, $green) = @ARG; my $bgcolor = '#FC8C8C'; if ($green) { $bgcolor = '#BBFFBB'; } print <<"-100-"; <br><br><br><br> <table align=center BGCOLOR="$bgcolor" cellpadding=15 border=3> <tr><td align=center><font size=5 face=Arial> <b>$Text</b></font></td></tr> </table><br><br><br><br><br> -100- if (!$continue) { ## fatal message print <<"-200-"; <table border=0 width=100%> <tr><td align=center><font size=4 face=Arial color="blue"> <b>Contact Whomever Necessary at 999-9999 (Mon-Fri, 8am-5pm +) for questions regarding use of the this application.</b> </font></td></tr> </table> </center> </body> </html> -200- exit; } print <<"-300-"; </center> </body> </html> -300- }
--Jim
In reply to Re: How to write to log files?
by jlongino
in thread How to write to log files?
by ajt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |