SitePoint Sponsor |
|
User Tag List
View Poll Results: As you work (offline) do you have error reporting turned on?
- Voters
- 16. You may not vote on this poll
-
error_reporting turned on and display them in output
8 50.00% -
error_reporting turned on but only log them
3 18.75% -
error_reporting turned on and both display and log them
4 25.00% -
error_reporting turned off
1 6.25% -
what is error_reporting?
0 0%
Results 1 to 18 of 18
-
Nov 13, 2008, 11:31 #1
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
Which error_reporting levels do you use, if at all?
Following on from something i just read in another thread, one way of dealing with irksome error messages (E_WARNING) is to simply turn them off.
It is a surprisingly simple way of simplifying some of your code I suppose.
I have been running display_errors, and E_ALL for a few years now and never really give it a second thought.
Now I am only talking about on your development environment, and I am not particularly concerned about how you log Live server errors.
So, as you are working away do you display errors or not?
To what level?
Do you log them as well?
Let me know either way, and why you do that.
-
Nov 13, 2008, 11:35 #2
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
2 for development
0 for productionMike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Nov 13, 2008, 11:41 #3
- Join Date
- Oct 2006
- Location
- Kathmandu, Nepal
- Posts
- 4,013
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
error_reporting(E_ALL);
display_error = ON;Mistakes are proof that you are trying.....
------------------------------------------------------------------------
PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5
-
Nov 13, 2008, 11:43 #4
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
Too quick, hadn't got my poll together...
I run on E_ALL and display the errors. I recently started using an Ajax framework on a CMS so the errors ruin my headers, so on that I am just logging errors, not notices, but generally I work with errors displaying.
Are Notices a bad thing?
Edit:
Doh, that's two of you ...
-
Nov 13, 2008, 12:11 #5
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
Usually I just use the default to start with. Then once things are cleaned up and if I'm feeling adventurous I'll run it with STRICT to
ensure the best interoperability and forward compatibility of your code.
I usually don't log errors during development. Except after things are fairly cleaned up and then usually only in "behind the scenes" files. i.e. scripts that don't get rendered.Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Nov 13, 2008, 12:15 #6
- Join Date
- Jun 2006
- Location
- Wigan, Lancashire. UK
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
error_reporting(E_ALL) for development, but logged with a full stack trace by a custom error handler;
error_reporting(E_ERROR) in production environments
-
Nov 13, 2008, 16:17 #7
- Join Date
- Dec 2005
- Posts
- 117
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
E_ALL. I display the errors, and log the warnings and notices.
-
Nov 13, 2008, 16:24 #8
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
I display strict errors, warnings and notices in development and log them in production.
No excuse for hiding them under the rugJake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
-
Nov 13, 2008, 16:34 #9
-
Nov 13, 2008, 17:05 #10
That's my preference too!
Here's the code I generally use:
Code:error_reporting(E_ALL); //report all errors, warnings ini_set('display_errors','0'); //prevent errors displaying to browser ini_set('log_errors','on'); //set error logging to on ini_set("ignore_repeated_errors","1"); //ignore repeated errors in loops ini_set('error_log',"../logs/errors.txt"); //set an error logging file path
-
Nov 13, 2008, 23:09 #11
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
During development I run E_ALL, and usually display them in addition to logging.
-
Nov 14, 2008, 03:05 #12
- Join Date
- Aug 2008
- Location
- Oslo, Norway
- Posts
- 39
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Display errors during developement. I log them in production, and at the same time output a custom error message if the page fail to load as expected.
Allways E_ALL.
-
Nov 14, 2008, 03:47 #13
-
Nov 14, 2008, 06:12 #14
- Join Date
- Aug 2008
- Location
- Oslo, Norway
- Posts
- 39
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Could be that he don't have access to the ini. I have had that problem in some projects.
-
Nov 14, 2008, 06:45 #15
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
No access to php.ini on a development machine? That seems hard to believe.
Then again, maybe Mounty needs to override the ini settings on the live server.
-
Nov 14, 2008, 12:45 #16
- Join Date
- May 2007
- Location
- Poole, UK
- Posts
- 5,077
- Mentioned
- 103 Post(s)
- Tagged
- 0 Thread(s)
At the moment I'm using: E_ALL, E_STRICT, E_NOTICE, E_ERROR, E_WARNING, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, E_RECOVERABLE_ERROR, E_DEPRECATED as I want to be 100% sure that absolutely all errors, notices, strict and anything else is displayed so i can fix them all and make sure I have less bugs and more secure code.
Community Team Advisor
Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator
-
Nov 15, 2008, 03:31 #17
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
Isn't that the same as E_ALL though?
-
Nov 15, 2008, 10:03 #18
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
From http://us2.php.net/manual/en/errorfunc.constants.php
E_ALL - All errors and warnings, as supported, except of level E_STRICT in PHP < 6.Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
Bookmarks