[ic] Pushing Error Log into MySQL?

Ethan Rowe ethan at endpoint.com
Thu Jul 28 11:32:45 EDT 2005


Jason Korkin wrote:

>>I'm not sure it would be that big of a job.  Since most every write to
>>the error.log is through the logError subroutine in Vend::Util, the
>>logError subroutine could be modified to redirect the errors to a
>>database table instead of a file.
>>
>>    
>>
>
>Hi Duane,
>
>I agree and I've started writing a modification to dump the errors into a db
>table rather than the flat file.  
>
>Once I get it working, I'll post the modified code to the list as I'm sure
>that others would probably like to utilize it as well for automatic
>generation of bug reports, etc. which is my ultimate goal.
>
>Jason
>
>  
>
Whether or not it can be done, is putting the error log directly into a 
database really all that desirable in the long run?

For one, which component is more likely to cause problems, and thus be 
the source of the very errors you wish to log?  Your file system, or 
your database?

Ideally, both are just fine, of course. :)

Do you really want an error message to trigger what amounts to a 
relatively expensive event (a database write)?  Consider that error 
messages can be caused by as little as carelessly mistyping a column 
name in an [sql-param ...] tag, and thus occur many times on a single 
page.  I would be extremely hesitant to impose this overhead on any 
system.  One mistake on a busy page on a busy site and your database 
gets hammered.

The error log files aren't necessarily the most readable things in the 
world, particular if the error message spans multiple lines.  However, 
consider that every new message begins with an identifiable string, and 
all subsequent lines within that same message are prefixed with an ">".  
What's the matter with pulling messages into the database in an offline 
fashion?  These logs cry out for Perl parsing.

I don't at all dispute the notion that having log data in a database 
might be helpful.  I would suggest, however, that just writing a script 
for pulling the logs into your DB in an offline process is ultimately 
preferable to the direct-to-database logging, as it avoids increasing 
the burden on your server when errors occur (no way would I want to use 
direct-to-database logging with PostgreSQL, for one, but I imagine 
writes on InnoDB tables in MySQL are slower than writes to MyISAM too).  
A script for doing this might be more generically useful for the all.

Just offering some contrary opinions for your consideration; certainly 
no harm meant by them. :)

- Ethan

-- 
Ethan Rowe
End Point Corporation
ethan at endpoint.com



More information about the interchange-users mailing list