Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
You should grab 2.1.9, released 18 March. It's what all the cool kids are doing.

Is there a Logger in Vanilla?

businessdadbusinessdad Stealth contributor MVP
edited March 2012 in Vanilla 2.0 Help

Hi again,
I'm still developing my first plugin and I need to log some messages during execution, but I couldn't figure out if there's a logging function/module in Vanilla. I see there's a gdn_log table, but, in my installation, it's always empty no matter what happens. Should I configure/install something in particular? Thanks.

Best Answer

  • x00x00 MVP
    Answer ✓

    have a look at dashboard/class.logmodel.php

    it is used for logging with Insert

    * @param string $Operation The operation being performed. This is usually one of:
    *  - Delete: The record has been deleted.
    *  - Edit: The record has been edited.
    *  - Spam: The record has been marked spam.
    *  - Moderate: The record requires moderation.
    * @param string $RecordType The type of record being logged. This usually correspond to the tablename of the record.
    * @param array $Data The record data.
    *  - If you are logging just one row then pass the row as an array.
    *  - You can pass an additional _New element to tell the logger what the new data is.
    * @return int The log id.

    So it is generally used for logging operations on user content, and specifically posts I you want to do somethign different I suggest, creating your own.

    for debug error logging turn it on in config

      $Configuration['Garden']['Errors']['LogEnabled']  = TRUE;
      $Configuration['Garden']['Errors']['LogFile']  = 'log/error_log';

    make sure you have file permissions set for /log. You can use

    LogMessage(__FILE__,__LINE__,'Object','Method', 'Message');

    grep is your friend.


Sign In or Register to comment.