- Complete Working Example
- Symfony - CMF Edition
- Symfony - REST Edition
- Symfony - Advanced Concepts
- Symfony - Unit Testing
- Symfony - Email Management
- Symfony - Logging
- Symfony - Internationalization
- Cookies & Session Management
- Symfony - Ajax Control
- Symfony - File Uploading
- Symfony - Validation
- Symfony - Forms
- Symfony - Doctrine ORM
- Symfony - View Engine
- Symfony - Routing
- Symfony - Controllers
- Creating a Simple Web Application
- Symfony - Bundles
- Symfony - Expression
- Symfony - Events & EventListener
- Symfony - Service Container
- Symfony - Components
- Symfony - Architecture
- Symfony - Installation
- Symfony - Introduction
- Symfony - Home
Symfony Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Symfony - Logging
Logging is very important for a web apppcation. Web apppcations are used by hundreds to thousands of users at a time. To get sneak preview of happenings around a web apppcation, Logging should be enabled. Without logging, the developer will not be able to find the status of the apppcation. Let us consider that an end customer reports an issue or a project stackholder reports performance issue, then the first tool for the developer is Logging. By checking the log information, one can get some idea about the possible reason of the issue.
Symfony provides an excellent logging feature by integrating Monolog logging framework. Monolog is a de-facto standard for logging in PHP environment. Logging is enabled in every Symfony web apppcation and it is provided as a Service. Simply get the logger object using base controller as follows.
$logger = $this->get( logger );
Once the logger object is fetched, we can log information, warning, and error using it.
$logger->info( Hi, It is just a information. Nothing to worry. ); $logger->warn( Hi, Something is fishy. Please check it. ); $logger->error( Hi, Some error occured. Check it now. ); $logger->critical( Hi, Something catastrophic occured. Hurry up! );
Symfony web apppcation configuration file app/config/config.yml has a separate section for the logger framework. It can be used to update the working of the logger framework.
Advertisements