php-symfonyHow to set the log level in PHP Symfony?
The log level in PHP Symfony can be set by using the logger
service.
$logger = $this->get('logger');
$logger->setLevel(Logger::ERROR);
The above code sets the log level to ERROR
.
The following are the available log levels in PHP Symfony:
Logger::EMERGENCY
: System is unusableLogger::ALERT
: Action must be taken immediatelyLogger::CRITICAL
: Critical conditionsLogger::ERROR
: Error conditionsLogger::WARNING
: Warning conditionsLogger::NOTICE
: Normal but significant conditionLogger::INFO
: Informational messagesLogger::DEBUG
: Debug-level messages
Helpful links
More of Php Symfony
- How to create a model in PHP Symfony?
- How to check PHP Symfony version?
- How to update an entity in PHP Symfony?
- How to generate a model in PHP Symfony?
- How to create tests in Symfony with PHP?
- How to do validation in PHP Symfony?
- How to generate UUIDs in PHP Symfony?
- How to use Sonata with Symfony and PHP?
- How to use PHP Symfony with gRPC?
- How to use the messenger component in PHP Symfony?
See more codes...