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
  1. #1
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    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.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    2 for development
    0 for production
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    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

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    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 ...

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,169
    Mentioned
    190 Post(s)
    Tagged
    2 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.
    which is usually a very enlightening and humbling experience. I am blessed/cursed with a tendency towards perfectionism, and I guess at times maybe I have a bit of masochism in me as well.

    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.

  6. #6
    SitePoint Evangelist
    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
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  7. #7
    SitePoint Zealot
    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.

  8. #8
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    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 rug
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  9. #9
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by arkinstall View Post
    I display strict errors, warnings and notices in development and log them in production.

    No excuse for hiding them under the rug
    Absolutely, fix em - dont hide em!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  10. #10
    SitePoint Enthusiast Mounty's Avatar
    Join Date
    Mar 2008
    Location
    UK
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall View Post
    I display strict errors, warnings and notices in development and log them in production.

    No excuse for hiding them under the rug


    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

  11. #11
    SitePoint Wizard bronze trophy
    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.

  12. #12
    SitePoint Enthusiast
    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.

  13. #13
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Mounty View Post
    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
    Is there a reason why you don't just set these in your development machine's php.ini file?

  14. #14
    SitePoint Enthusiast
    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.

  15. #15
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    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.

  16. #16
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,027
    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

  17. #17
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    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?

  18. #18
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,169
    Mentioned
    190 Post(s)
    Tagged
    2 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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •