yii\log\FileTarget::init PHP Method

init() public method

This method is invoked after the route is created by the route manager.
public init ( )
    public function init()
    {
        parent::init();
        if ($this->logFile === null) {
            $this->logFile = Yii::$app->getRuntimePath() . '/logs/app.log';
        } else {
            $this->logFile = Yii::getAlias($this->logFile);
        }
        $logPath = dirname($this->logFile);
        if (!is_dir($logPath)) {
            FileHelper::createDirectory($logPath, $this->dirMode, true);
        }
        if ($this->maxLogFiles < 1) {
            $this->maxLogFiles = 1;
        }
        if ($this->maxFileSize < 1) {
            $this->maxFileSize = 1;
        }
    }

Usage Example

 /**
  * Initializes the route.
  * This method is invoked after the route is created by the route manager.
  */
 public function init()
 {
     parent::init();
     ini_set('precision', 20);
 }