Description

Logger records logged messages in memory and sends them to different targets according to [[targets]].

A Logger instance can be accessed via Yii::getLogger(). You can call the method [[log()]] to record a single log message. For convenience, a set of shortcut methods are provided for logging messages of various severity levels via the [[Yii]] class:

  • [[Yii::debug()]]
  • [[Yii::error()]]
  • [[Yii::warning()]]
  • [[Yii::info()]]

For more details and usage information on Logger, see the guide article on logging and PSR-3 specification.

When the application ends or [[flushInterval]] is reached, Logger will call [[flush()]] to send logged messages to different log targets, such as [[FileTarget|file]], [[EmailTarget|email]], or [[DbTarget|database]], according to the [[targets]].

Type hierarchy

psr/log dev-master 1.1.3
View more packages
psr-php7/log dev-master 1.0.0
redweb-tn/codeigniter4 dev-master 4.0
resque/yii2-resque dev-master
rkr/amazon-pay-sdk-php 2.x-dev
sammet/gestion-colecciones dev-master
ortnit/logger dev-master
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/psyii2 dev-master
phpsmile/yii2 dev-master 2.1.x-dev
redooc/yii2-dev dev-master
ruvents/yii 2.1.x-dev
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/psyii2 dev-master
phpsmile/yii2 dev-master 2.1.x-dev
redooc/yii2-dev dev-master
ruvents/yii 2.1.x-dev
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/yii2 2.1.x-dev
ruvents/yii 2.1.x-dev
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/psyii2 dev-master
phpsmile/yii2 dev-master 2.1.x-dev
redooc/yii2-dev dev-master 2.1.x-dev
ruvents/yii 2.1.x-dev
ruvents/yii2 dev-master 2.0.29
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/psyii2 dev-master
phpsmile/yii2 dev-master 2.1.x-dev
redooc/yii2-dev dev-master
ruvents/yii 2.1.x-dev
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/yii2 2.1.x-dev
ruvents/yii 2.1.x-dev
pfilsx/yii2-migration-core dev-master 1.0.2
phpsmile/psyii2 dev-master
phpsmile/yii2 dev-master 2.1.x-dev
redooc/yii2-dev dev-master 2.1.x-dev
ruvents/yii 2.1.x-dev

Class usage:

This class is used in:
Class Package
Codeception\Lib\Connector\Yii2\Logger
codeception/codeception 2.6.x-dev
yii\log\Dispatcher
pfilsx/yii2-migration-core dev-master
yii\log\SyslogTarget
pfilsx/yii2-migration-core dev-master
yii\log\Target
pfilsx/yii2-migration-core dev-master
yii\BaseYii
pfilsx/yii2-migration-core dev-master
yii\log\Dispatcher
pfilsx/yii2-migration-core 1.0.2
yii\log\SyslogTarget
pfilsx/yii2-migration-core 1.0.2
yii\log\Target
pfilsx/yii2-migration-core 1.0.2
yii\BaseYii
pfilsx/yii2-migration-core 1.0.2
enterprise\components\FileTarget
phantom-d/yii2-enterprise-module dev-master
enterprise\components\FileTarget
phantom-d/yii2-enterprise-module 1.0.0.1
phantomd\filedaemon\components\FileTarget
phantom-d/yii2-file-daemon dev-master
PHPKitchen\Domain\Mixins\LoggerAccess
php-kitchen/yii2-domain dev-master
PHPKitchen\Domain\Mixins\LoggerAccess
php-kitchen/yii2-domain 0.0.x-dev
yii\log\Dispatcher
phpsmile/psyii2 dev-master
yii\log\SyslogTarget
phpsmile/psyii2 dev-master
yii\log\Target
phpsmile/psyii2 dev-master
yii\BaseYii
phpsmile/psyii2 dev-master
yii\log\Dispatcher
phpsmile/yii2 dev-master
yii\log\SyslogTarget
phpsmile/yii2 dev-master
yii\log\Target
phpsmile/yii2 dev-master
yii\BaseYii
phpsmile/yii2 dev-master
m141106_185632_log_init
phpsmile/yii2 2.1.x-dev
yii\log\SyslogTarget
phpsmile/yii2 2.1.x-dev
yii\log\Target
phpsmile/yii2 2.1.x-dev
yii\BaseYii
phpsmile/yii2 2.1.x-dev
yii\base\ErrorHandler
phpsmile/yii2 2.1.x-dev
vps\tools\log\SentryTarget
pulsarvp/vps-tools dev-master
vps\tools\log\LogstashTarget
pulsarvp/vps-tools dev-master
vps\tools\log\SentryTarget
pulsarvp/vps-tools 1.41.3
vps\tools\log\LogstashTarget
pulsarvp/vps-tools 1.41.3
vps\tools\log\SentryTarget
pulsarvp/vps-tools 0.7.13
putyourlightson\blitz\drivers\purgers\CloudflarePurger
putyourlightson/craft-blitz v2.x-dev
putyourlightson\blitz\drivers\storage\FileStorage
putyourlightson/craft-blitz v2.x-dev
putyourlightson\blitz\services\WarmCacheService
putyourlightson/craft-blitz v2.x-dev
putyourlightson\blitz\services\GenerateCacheService
putyourlightson/craft-blitz v2.x-dev
putyourlightson\logtofile\LogToFile
putyourlightson/craft-log-to-file v1.x-dev
pvsaintpe\boost\log\PsrLogger
pvsaintpe/yii2-boost dev-master
pvsaintpe\boost\log\StdoutTarget
pvsaintpe/yii2-boost dev-master
pvsaintpe\boost\base\ModelDebugTrait
pvsaintpe/yii2-boost dev-master
pvsaintpe\boost\log\PsrLogger
pvsaintpe/yii2-boost 2.2.6
pvsaintpe\boost\log\StdoutTarget
pvsaintpe/yii2-boost 2.2.6
pvsaintpe\boost\base\ModelDebugTrait
pvsaintpe/yii2-boost 2.2.6
pvsaintpe\boost\log\PsrLogger
pvsaintpe/yii2-boost 1.0.3
pvsaintpe\boost\log\StdoutTarget
pvsaintpe/yii2-boost 1.0.3
pvsaintpe\boost\base\ModelDebugTrait
pvsaintpe/yii2-boost 1.0.3
qiumoon\EsTarget
qiumoon/eslog dev-master
qiumoon\EsTarget
qiumoon/eslog v0.4
yii\mongodb\debug\MongoDbPanel
quangvule/yii2-mongodb dev-master
yii\mongodb\debug\MongoDbPanel
quangvule/yii2-mongodb 2.0.4
Rf\Modules\Worker\OwnLogTrait
raid3r81/worker-module dev-master
Rf\Modules\Worker\OwnLogTrait
raid3r81/worker-module 1.0.1
App\Console\Controller\Controller
razonyang/yii2-app-template dev-master
App\Console\Controller\Controller
razonyang/yii2-app-template v1.1.1
RazonYang\Yii2\Psr\Log\Logger
razonyang/yii2-psr-log dev-master
RazonYang\Yii2\Psr\Log\Logger
razonyang/yii2-psr-log 1.0.0
RazonYang\Yii2\Psr\Logger\Logger
razonyang/yii2-psr-logger dev-master
yii\log\Dispatcher
redooc/yii2-dev dev-master
yii\log\SyslogTarget
redooc/yii2-dev dev-master
yii\log\Target
redooc/yii2-dev dev-master
yii\BaseYii
redooc/yii2-dev dev-master
yii\debug\panels\DbPanel
redooc/yii2-dev dev-master
yii\debug\panels\LogPanel
redooc/yii2-dev dev-master
yii\debug\panels\ProfilingPanel
redooc/yii2-dev dev-master
yii\elasticsearch\DebugPanel
redooc/yii2-dev dev-master
yii\mongodb\debug\MongoDbPanel
redooc/yii2-dev dev-master
yii\log\Dispatcher
redooc/yii2-dev 2.1.x-dev
yii\log\SyslogTarget
redooc/yii2-dev 2.1.x-dev
yii\log\Target
redooc/yii2-dev 2.1.x-dev
yii\BaseYii
redooc/yii2-dev 2.1.x-dev
yii\debug\panels\DbPanel
redooc/yii2-dev 2.1.x-dev
yii\debug\panels\LogPanel
redooc/yii2-dev 2.1.x-dev
yii\debug\panels\ProfilingPanel
redooc/yii2-dev 2.1.x-dev
yii\elasticsearch\DebugPanel
redooc/yii2-dev 2.1.x-dev
yii\mongodb\debug\MongoDbPanel
redooc/yii2-dev 2.1.x-dev
reketaka\helps\common\models\CommonRecord
reketaka/yii2-helps dev-master
reketaka\helps\common\models\CommonRecord
reketaka/yii2-helps 1.230
Rekurzia\Log\SentryTarget
rekurzia/yii2-sentry-log-target dev-master
Rekurzia\Log\SentryTarget
rekurzia/yii2-sentry-log-target v2.0.0
Rekurzia\log\SentryTarget
rekurzia/yii2-sentry-log-target v1.0.0
Rekurzia\log\SentryTarget
rekurzia/yii2-sentry-log-target v0.9.0
reuhtte\admin\components\Defender
reuhtte/yii2-admin dev-master
reuhtte\admin\components\Defender
reuhtte/yii2-admin v0.1.3
ruslan89\seo\components\Seo
ruslan89/yii2-seo-module dev-master
yii\log\Dispatcher
ruvents/yii 2.1.x-dev
yii\log\SyslogTarget
ruvents/yii 2.1.x-dev
yii\log\Target
ruvents/yii 2.1.x-dev
yii\BaseYii
ruvents/yii 2.1.x-dev
yii\log\Dispatcher
ruvents/yii2 dev-master
yii\log\SyslogTarget
ruvents/yii2 dev-master
yii\log\Target
ruvents/yii2 dev-master
yii\BaseYii
ruvents/yii2 dev-master
m141106_185632_log_init
ruvents/yii2 3.0.0-alpha1
yii\log\SyslogTarget
ruvents/yii2 3.0.0-alpha1
yii\log\Target
ruvents/yii2 3.0.0-alpha1
yii\BaseYii
ruvents/yii2 3.0.0-alpha1
yii\base\ErrorHandler
ruvents/yii2 3.0.0-alpha1
yii\log\Dispatcher
ruvents/yii2 2.0.29
yii\log\SyslogTarget
ruvents/yii2 2.0.29
yii\log\Target
ruvents/yii2 2.0.29
yii\BaseYii
ruvents/yii2 2.0.29
yii2tech\filestorage\local\Bucket
salevan/file-storage dev-master
yii2tech\filestorage\BaseBucket
salevan/file-storage dev-master
yii2tech\filestorage\BaseStorage
salevan/file-storage dev-master
yii2tech\filestorage\amazon\Bucket
salevan/file-storage dev-master
samdark\log\PsrTarget
samdark/yii2-psr-log-target dev-master
samdark\log\tests\PsrTargetTest
samdark/yii2-psr-log-target dev-master
samdark\log\tests\PsrTargetLevelsTest
samdark/yii2-psr-log-target dev-master
samdark\log\PsrTarget
samdark/yii2-psr-log-target 1.1.2
samdark\log\tests\PsrTargetTest
samdark/yii2-psr-log-target 1.1.2
samdark\log\tests\PsrTargetLevelsTest
samdark/yii2-psr-log-target 1.1.2
Mero\Monolog\Target\MonologTarget
sbooker/yii2-monolog dev-master
Mero\Monolog\Target\MonologTarget
sbooker/yii2-monolog 0.2.2
craft\helpers\App
seesoft/cms dev-master
kak\clickhouse\debug\Panel
seniorcat/kak-clickhouse dev-master
yii\debug\panels\DbPanel
senyor/yii2-debug dev-master
yii\debug\panels\LogPanel
senyor/yii2-debug dev-master
yii\debug\panels\RouterPanel
senyor/yii2-debug dev-master
yii\debug\panels\ProfilingPanel
senyor/yii2-debug dev-master
yii\debug\models\Router
senyor/yii2-debug dev-master
yii\debug\panels\DbPanel
senyor/yii2-debug 2.0.13
yii\debug\panels\LogPanel
senyor/yii2-debug 2.0.13
yii\debug\panels\RouterPanel
senyor/yii2-debug 2.0.13
yii\debug\panels\ProfilingPanel
senyor/yii2-debug 2.0.13
yii\debug\models\Router
senyor/yii2-debug 2.0.13
sergeymakinen\yii\logmessage\Message
sergeymakinen/yii2-log-message dev-master
sergeymakinen\yii\logmessage\Message
sergeymakinen/yii2-log-message v2.1.0
sergeymakinen\yii\slacklog\Target
sergeymakinen/yii2-slack-log dev-master
sergeymakinen\yii\slacklog\Target
sergeymakinen/yii2-slack-log v2.0.1
sergeymakinen\yii\telegramlog\Target
sergeymakinen/yii2-telegram-log dev-master
sergeymakinen\yii\telegramlog\Target
sergeymakinen/yii2-telegram-log v2.0.0
shardimage\yii2shardimage\Logger
shardimage/yii2-shardimage dev-master
shardimage\yii2shardimage\Logger
shardimage/yii2-shardimage 1.0.0-alpha6
sheershoff\sentry\Target
sheershoff/yii2-sentry-component dev-master
sheershoff\sentry\Target
sheershoff/yii2-sentry-component 1.0.8
Sil\Log\EmailTarget
silinternational/yii2-email-log-target dev-master
Sil\Log\EmailTarget
silinternational/yii2-email-log-target 1.0.1
Sil\JsonLog\JsonLogHelper
silinternational/yii2-json-log-targets dev-master
Sil\JsonLog\JsonLogHelper
silinternational/yii2-json-log-targets 2.0.0
Sil\JsonLog\JsonLogHelper
silinternational/yii2-json-log-targets 1.1.0
Sil\JsonLog\JsonLogHelper
silinternational/yii2-json-log-targets 0.3.2
Sil\JsonSyslog\JsonSyslogTarget
silinternational/yii2-jsonsyslog dev-master
Sil\JsonSyslog\JsonSyslogTarget
silinternational/yii2-jsonsyslog 1.0.0
simonefalcini\SlackTarget\SlackTarget
simonefalcini/slacktarget 1.4.3
gateway\gateways\Base
affka/yii2-gateway dev-master
gateway\GatewayModule
affka/yii2-gateway dev-master
gateway\gateways\Base
affka/yii2-gateway 1.2.16
gateway\GatewayModule
affka/yii2-gateway 1.2.16
agielks\yii2\jsonlog\TraitJsonTarget
agielks/yii2-json-log dev-master
istranger\rSmartLoad\RSmartLoad
istranger/yii2-resource-smart-load dev-master
istranger\rSmartLoad\RSmartLoad
istranger/yii2-resource-smart-load v1.1.2
itdocs\xunsearch\DebugPanel
itdocs/xunsearch dev-master
itdocs\xunsearch\DebugPanel
itdocs/xunsearch 1.4.0
yii\boost\log\PsrLogger
ivan-chkv/yii2-boost dev-master
yii\boost\log\StdoutTarget
ivan-chkv/yii2-boost dev-master
yii\boost\base\ModelDebugTrait
ivan-chkv/yii2-boost dev-master
yii\boost\log\PsrLogger
ivan-chkv/yii2-boost 1.0.41
yii\boost\log\StdoutTarget
ivan-chkv/yii2-boost 1.0.41
yii\boost\base\ModelDebugTrait
ivan-chkv/yii2-boost 1.0.41
yii\elasticsearch\ElasticsearchTarget
larkit/yii2-elasticsearch dev-master
yii\elasticsearch\DebugPanel
larkit/yii2-elasticsearch dev-master
yii\elasticsearch\ElasticsearchTarget
larkit/yii2-elasticsearch 2.1.x-dev
yii\elasticsearch\DebugPanel
larkit/yii2-elasticsearch 2.1.x-dev
hightman\xunsearch\DebugPanel
lcp0578/xunsearch dev-master
hightman\xunsearch\DebugPanel
lcp0578/xunsearch 1.4.12
nystudio107\webperf\log\ProfileTarget
nystudio107/craft-webperf v1.x-dev
OlegTsvetkov\Yii2\Sentry\LogTarget
olegtsvetkov/yii2-sentry dev-master
OlegTsvetkov\Yii2\Sentry\LogTarget
olegtsvetkov/yii2-sentry v1.4
onedesign\airbrake\targets\AirbrakeTarget
onedesign/airbrake-craft dev-master
sentry\SentryTarget
opus-online/yii2-sentry-log dev-master
panlatent\odoo\debug\OdooPanel
panlatent/yii2-odoo dev-master
pashkinz92\SlackLogger
pashkinz92/slack-yii2 dev-master
pashkinz92\SlackLogger
pashkinz92/slack-yii2 1.0.1
pashkinz92\SlackLogger
pashkinz92/slack-yii2 0.2
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock dev-master
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock v5.0
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock v4.0
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock v3.2
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock v2.0
pastuhov\logstock\LogTarget
pastuhov/yii2-logstock v1.20
payprocessing\graylog\GraylogTarget
payprocessing/yii2-graylog2 dev-master
payprocessing\graylog\GraylogTarget
payprocessing/yii2-graylog2 v1.0.1