How to logging in Symfony 1.x in Model, View and Controller

Sometimes you need to send something to symfony webdebug. there are three ways depended on  where you are going to log from.

Logging in Model

sfContext::getInstance()->getLogger()->log($message, $level);

Logging in View

<?php use_helper(‘Debug’) ?>
<?php log_message($message, $level) ?>

Logging in Action

$this->logMessage($message, $level);

Have fun! 🙂

Leave a Comment: