Skip to content
pakainfo

Pakainfo

Web Development & Good Online education

  • Home
  • Blog
  • Categories
  • Tools
  • Full Form
  • Guest Post
  • Advertise
  • About
  • Contact Us

How to create a log file PHP Yii Framework

August 9, 2018 Pakainfo Programming, php, Yii Leave a comment

How to create a log file PHP Yii Framework

Today, We want to share with you How to create a log file PHP Yii Framework.
In this post we will show you php – YII logging for debugging, hear for PHP yii Framework Error handling, Debugging, and Logging we will give you demo and example for implement.
In this post, we will learn about PHP Yii Framework Logging Basics with an example.

PHP Yii Framework – Logging

Contents

    • PHP Yii Framework – Logging
    • PHP YII framework Logging Location
  • Simpl Step To Create a log file PHP Yii Framework
    • Read
    • Summary
    • Related posts

To log a create error or message, We should call one of the following some Yii Methods

  • Yii::error() βˆ’ Display row a fatal error message.
  • Yii::warning() βˆ’ debug a warning message.
  • Yii::info() βˆ’ create a new a message with some change the information.
  • Yii::trace() βˆ’ Data new row a message to debug how a errro piece of lins of the code runs.
Also Read This πŸ‘‰   download csv file in php example

PHP YII framework Logging Location

Where the log file will be stored in PHP YII framework?

We can simple Path find it here easily Protected/runtime/application.log, And We can simple PHP Framework Yii enable the create weblog in protected/config/main.php

Simpl Step To Create a log file PHP Yii Framework

Step 1 βˆ’ We can simple register multiple file log target as well, such as.

return [
   // the PHP Yii "log" component is main loaded during run time
   'bootstrap' => ['log'],
   'components' => [
      'log' => [
         'targets' => [
            [
               'class' => 'yii\log\DbTarget',
			   // 4 Types og the generated logs
               'levels' => ['error', 'warning', 'trace', 'info'],
            ],
            [
               'class' => 'yii\log\EmailTarget',
               'levels' => ['error', 'warning'],
               'categories' => ['yii\db\*'],
               'message' => [
                  'from' => ['[email protected]'],
                  'to' => ['[email protected]', '[email protected]'],
                  'subject' => 'Application errors at pakainfo.com',
               ],
            ],
         ],
      ],
   ],
];

Step 2 βˆ’ To PHP Yii Framework customize this date and time format, We need to settings the yii\log\Target::$prefix some property.

Also Read This πŸ‘‰   Responsive Dropdown Navigation Bar

[
   'class' => 'yii\log\FileTarget',
   'prefix' => function ($message) {
      $client = Yii::$app->has('client', true) ? Yii::$app->get('client') :
      'undefined client';
      $clientID = $client ? $client->getId(false) : 'anonym';
      return "[$clientID]";
   }
]

How to create a logfile in PHP

Read :

  • Technology
  • Google Adsense
  • Programming

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Introduction To PHP Yii – Logging.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related posts:

  1. How To Create Image Hover Overlay Effects?
  2. How To Create Social Media icons footer using bootstrap?
  3. Multiple image slider in html source code
  4. How To Create a Mobile Navigation hamburger Menu using CSS?
  5. WordPress Next Previous Article/post using CSS
  6. Yii Framework Introduction and Hello World Tutorial
  7. How to create a responsive header in HTML and CSS?
  8. jQuery An Animated Scroll To Top Button
  9. Create Scroll Back to Top Button using jQuery and CSS
  10. Laravel 5.6 Like Dislike rating system with jQuery, Ajax and PHP
Also Read This πŸ‘‰   pie chart in php with database - How to Make Pie Chart in Php and Mysql?
create log file in yiihow to create log in yii2yii log file locationyii trace exampleyii::log()yii2 debug logyii2 log user activityyii2 not logging

Post navigation

Previous Post:Introduction To Insurance Basics with Example
Next Post:Top 10 Greatest US Latest Technology Products

Advertise With Us

Increase visibility and sales with advertising. Let us promote you online.
Click Here

Write For Us

We’re accepting well-written informative guest posts and this is a great opportunity to collaborate.
Submit a guest post to [email protected]
Contact Us

Freelance web developer

Do you want to build a modern, lightweight, responsive website quickly?
Need a Website Or Web Application Contact : [email protected]
Note: Paid Service
Contact Me

Categories

3movierulz (64) Ajax (464) AngularJS (377) ASP.NET (61) Bio (109) Bollywood (108) Codeigniter (175) CSS (98) Earn Money (69) Education (61) Entertainment (130) fullform (86) Google Adsense (63) Highcharts (77) History (40) Hollywood (109) JavaScript (1357) Jobs (42) jQuery (1423) Laravel (1088) LifeStyle (53) movierulz4 (63) Mysql (1029) Mysqli (890) php (2121) Programming (2332) Python (97) Software (166) Software (88) Stories (98) tamilrockers (104) Tamilrockers kannada (64) Tamilrockers telugu (61) Tech (142) Technology (2392) Tips and Tricks (119) Tools (203) Top10 (478) Trading (90) Trending (71) VueJs (250) Web Technology (105) webtools (191) wordpress (166) World (322)

A To Z Full Forms

Access a complete full forms list with the meaning, definition, and example of the acronym or abbreviation.
Click Here
  • Home
  • About Us
  • Terms And Conditions
  • Write For Us
  • Advertise
  • Contact Us
  • Youtube Tag Extractor
  • Info Grepper
  • Guest Posting Sites
  • Increase Domain Authority
  • Social Media Marketing
  • Freelance web developer
  • Tools
Pakainfo 9-OLD, Ganesh Sco, Kothariya Ring Road, Chokadi, Rajkot - 360002 India
E-mail : [email protected]
Pakainfo

Β© 2023 Pakainfo. All rights reserved.

Top
Subscribe On YouTube : Download Source Code
We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype Guest Posting Sites