XF 2.2 Print Debug Messages

Trying to write my first add-on, extended Thread, I want to see the structure of $params, my code goes like this.

PHP:
class Thread extends XFCP_Thread
{
    public function actionEdit(ParameterBag $params)
    {
        // dump $params

        // the first way
        \XF::dump($params);
        \XF::dumpSimple($params);

        // the 2nd way
        \XF::logError('in logError');
        \XF::logException('in logException');

        // the 3rd way
        \XF\Util\File::log('debug.txt', 'using file log');

        // other code below works well.
    }
}

I have tried everything I could find but nothing works.

\XF::dump and dumpSimple: these two are supposed to print something on page, I see nothing. Is it because the action is taken between two templates (forum_post_thread and thread_view)? Can't find anything on execution time page either.

logError and logException are supposed to work no matter what, but no server errors were logged in ACP.

\XF\Util\File::log is the same.

I only use simple fake text in 2nd and 3rd method but still doesn't work.

If anyone can explain to me how these work, I would really appreciate it. Thanks!
 
Last edited:
Have you instructed XF to use your extended class instead of the base class via Class Extension?
 
Have you instructed XF to use your extended class instead of the base class via Class Extension?
Thanks, yes. My addon is checking thread titles and rejecting very short titles, other code below the debug string code works well.

I just couldn't print debug string.
 
Back
Top Bottom