views:

377

answers:

4

Until recently I've been using syslog in my System_Exception exception handler to log important errors - a pretty useful concept I thought. However my host just cut me off, and it appears that loveable syslog has actually been sending my error reports to everyone on the server (it's a shared server). They weren't too pleased.

I've now switched to using a log.txt (and will now have to secure this with chmod or something) - but does anyone have any other suggestions for me to try? This seems a bit rusty.

Oh, and don't use syslog on anything except a dedicated server or somewhere that can handle it ;-)

A: 

I like to log minor stuff to a database (if it's possible without slowing things down a lot). It makes it easier to go back and condense results from the log.

For fatal errors, I try to pipe them into FogBugz using ScoutSubmit

Mark Biek
+7  A: 

Try log4php. I'm using log4net for my .NET project and it's just terrific. :)

rafek
A: 

@Teiflon

I'm sorry, but that's a really terible practice. On a production site you should never output any internal errors to the user. This is why I'm trying to silently log my errors in a file. What you've suggested is perfectly fine during development, not when you've gone live (I'd also add the E_STRICT constant for PHP5 extras).


@Mark

My ownly problem is that when this exception is called, it might be because I can't connect to the database in the first place - however I agree that would be easier to display.

I've heard a lot (on here) about FogBugz and I'm about to check it out now - although I'd prefer to keep my errors to myself :)


@rafek

How exactly does that work? It certainly looks powerful but where does it output the logs?

Ross
I don't know how exactly php version works, but as Geoff said - it can log to files/console/db - I use all of them and it is powerfull.
rafek
+1  A: 

I use log4net. Great tool. It can output logs to files, database, emails, UDP, etc.

Personally, I output to files with the rolling File Appender. It makes reviewing logs very simple.

Geoff