Speaktech.in

yii2 logging

 

Yii  logging is highly customizable and extensible. Using this framework, you can easily log various types of messages, filter them, and gather them at different targets, such as files, databases, emails.

Using the Yii logging framework involves the following steps:

  • Record log messages at various places in your code;
  • Configure log targets in the application configuration to filter and export log messages;
  • Examine the filtered logged messages exported by different targets (e.g. the Yii debugger).

In this section, we will mainly describe the first two steps.

Log Messages

Recording log messages is as simple as calling one of the following logging methods:

  • Yii::debug(): record a message to trace how a piece of code runs. This is mainly for development use.
  • Yii::info(): record a message that conveys some useful information.
  • Yii::warning(): record a warning message that indicates something unexpected has happened.
  • Yii::error(): record a fatal error that should be investigated as soon as possible.


example:

Yii::info( 'shipping charge distirct id'.$district,'preneesh');

Yii::info(  $orderlines->getErrors(),'preneesh');