XF 2.1 Writing to the server log table?


Active member

Is it possible to log an error/exception to the server log so that I can monitor if something did not work during run time? I'm trying to use it in the complete function of the formAction so that I know if something went wrong at that time.

This is my public controller code
public function actionSaveProcess(\Asprin\FB\Entity\Foo $foo)
    $data = [
        'title' => 'str',
        'comment' => 'str'
    $input = $this->filter($data);
    $form = $this->formAction();
    $form->basicEntitySave($foo, $input);       
    $form->complete(function() use ($foo)
        // if something goes wrong here, write to server log
        // ? how to ??

I found a thread but that is for v1xx -> https://xenforo.com/community/threads/writing-to-server-error-log.84424/