Any way to capture errors in a file?

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
LinuxDude
Forum Newbie
Posts: 2
Joined: Sat Mar 15, 2008 5:02 pm

Any way to capture errors in a file?

Post by LinuxDude »

Here's a simple question: Right now, PHP displays errors right in the output it is generating, like:

Code: Select all

<br />
<b>Warning</b>:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Access denied for user
This is really a pain because I'm working on something which interacts over XML, so the only way for me to see these errors is to use TCPFLOW to capture packets as I run tests. That is beyond annoying and is an awful way to do development.

Reading the manual, I saw that I can use:

Code: Select all

ini_set("log_errors", true);
It has no effect. The errors still go into the output.

This shouldn't be hard... there must be some way of also dumping errors into a file? PHP has been around for years. I can't be the only one who wants to capture errors in a log, right?
LinuxDude
Forum Newbie
Posts: 2
Joined: Sat Mar 15, 2008 5:02 pm

Re: Any way to capture errors in a file?

Post by LinuxDude »

I figured it out. the ini_set() was not getting called. Once I fixed it, it did work, and is very helpful for capturing errors instead of dumping them to the output.
Post Reply