Piwik\
Logging utility class.
Log entries are made with a message and log level. The logging utility will tag each log entry with the name of the plugin that's doing the logging. If no plugin is found, the name of the current class is used.
You can log messages using one of the public static functions (eg, 'error', 'warning', 'info', etc.).
Currently, Matomo (formerly Piwik) supports the following logging backends:
Messages logged in the console will always be logged to the console output.
The logging utility can be configured by manipulating the INI config options in the
[log]
section.
The following configuration options can be set:
log_writers[]
: This is an array of log writer IDs. The three log writers provided
by Matomo core are file, screen, database, errorlog,
and syslog. You can get more by installing plugins. The default
value is screen.log_level
: The current log level. Can be ERROR, WARN, INFO, DEBUG,
or VERBOSE. Log entries made with a log level that is as or more
severe than the current log level will be outputted. Others will be
ignored. The default level is WARN.logger_file_path
: For the file log writer, specifies the path to the log file
to log to or a path to a directory to store logs in. If a
directory, the file name is piwik.log. Can be relative to
Matomo's root dir or an absolute path. Defaults to tmp/logs.logger_syslog_ident
: If configured to log to syslog, mark them with this
identifier string. This acts as an easy-to-find tag in
the syslog.The class defines the following methods:
getInstance()
ash; Returns the singleton instance for the derived class. Inherited from Singleton
error()
— Logs a message using the ERROR log level.warning()
— Logs a message using the WARNING log level.info()
— Logs a message using the INFO log level.debug()
— Logs a message using the DEBUG log level.verbose()
— Logs a message using the VERBOSE log level.getInstance()
Returns the singleton instance for the derived class. If the singleton instance has not been created, this method will create it.
Singleton
value.error()
Logs a message using the ERROR log level.
\Piwik\Log\LoggerInterface::error()
$message
(string
) —
The log message. This can be a sprintf format string.$printFparams
(mixed
) —
Optional sprintf params.warning()
Logs a message using the WARNING log level.
\Piwik\Log\LoggerInterface::warning()
$message
(string
) —
The log message. This can be a sprintf format string.$printFparams
(mixed
) —
Optional sprintf params.info()
Logs a message using the INFO log level.
\Piwik\Log\LoggerInterface::info()
$message
(string
) —
The log message. This can be a sprintf format string.$printFparams
(mixed
) —
Optional sprintf params.debug()
Logs a message using the DEBUG log level.
\Piwik\Log\LoggerInterface::debug()
$message
(string
) —
The log message. This can be a sprintf format string.$printFparams
(mixed
) —
Optional sprintf params.verbose()
Logs a message using the VERBOSE log level.
\Piwik\Log\LoggerInterface::debug()
$message
(string
) —
The log message. This can be a sprintf format string.$printFparams
(mixed
) —
Optional sprintf params.