Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to do error logging in plugin?

edited February 2011 in Vanilla 2.0 - 2.8
Can anyone point me in the right direction for writing to vanilla's error log when there is an error in a plugin?

Comments

  • Options
    SS ✭✭
    edited February 2011
    /conf/config.php
    $Configuration['Garden']['Errors']['LogEnabled'] = TRUE; $Configuration['Garden']['Errors']['LogFile'] = 'logs/error-log'; $Configuration['Garden']['Errors']['MasterView'] = 'deverror.master.php';
  • Options
    Yep that should set it up. How does one go about getting content into it.
    if it were java I would do...
    Logger logger = Logger.getLogger("package.classname");

    if(error condition){
    logger.error("Descriptive error text here to track down problem.");
    }
  • Options
    You want to log errors from your plugin into the logs/error-log textfile
    Good question. Maybe it's in the /docs how to do that, otherwise it should be in there (after we've figured it out how it works :-) )

    There was an error rendering this rich post.

  • Options
    edited February 2011
    You want to log errors from your plugin into the logs/error-log textfile
    Good question. Maybe it's in the /docs how to do that, otherwise it should be in there (after we've figured it out how it works :-) )
    @Todd I see you're working on documentation
  • Options
    @Lincon Could you provide any guidance/best practices?
  • Options
    LincLinc Detroit Admin
    edited March 2011
    I'm not entirely sure, but I think what you want is:

    throw new Exception($Msg, $Code);

    $Code is optional and would be something like '404' if it's a page not found (and would redirect to that route accordingly), and the message would be what gets logged. I think? Have never looked at the error log, honestly, just shooting blindly based on the code I've seen.
  • Options
    Thanks. I'll try playing around with it and see what happens.
Sign In or Register to comment.