Use of logging

Getting a log

To get a log object, call getLog on the service container object. The log must exist in logs.xml configuration file prior to being retrieved by the application.

$logger = Jadu_Service_Container::getInstance()->getLog('mylog');

Log a message

You log a message by calling a method on the logger object retrieved above. The method you call depends upon the type of message you want to log.

$logger->warning('My warning message');

Methods available are:

  • debug: Detailed debug information.

  • info: Interesting events. Examples: User logs in, SQL logs.

  • notice: Normal but significant events.

  • warning: Exceptional occurrences that are not errors.

  • error: Runtime errors that do not require immediate action but should typically be logged and monitored.

  • critical: Critical conditions.

  • alert: Action must be taken immediately.

  • emergency: Emergency: system is unusable.

results matching ""

    No results matching ""