Clears all Logger definitions from the logger hierarchy.
static
boolean
clear
()
Configures log4php.
This method needs to be called before the first logging event has occured. If this method is not called before then the default configuration will be used.
static
void
configure
([
string|array $configuration =
null], [
string|LoggerConfigurator $configurator =
null])
-
string|array
$configuration: Either a path to the configuration file, or a configuration array.
-
string|LoggerConfigurator
$configurator: A custom configurator class: either a class name (string), or an object which implements the LoggerConfigurator interface. If left empty, the default configurator implementation will be used.
check if a given logger exists.
static
boolean
exists
(string $name)
-
string
$name: logger name
Returns an array this whole Logger instances.
static
array
getCurrentLoggers
()
Returns the hierarchy used by this Logger.
Caution: do not use this hierarchy unless you have called initialize(). To get Loggers, use the Logger::getLogger and Logger::getRootLogger methods instead of operating on on the hierarchy directly.
Returns a Logger by name. If it does not exist, it will be created.
static
Logger
getLogger
(
string $name)
-
string
$name: The logger name
Destroy configurations for logger definitions
static
void
resetConfiguration
()
Safely close all appenders.
static
void
shutdown
()
Constructor.
Logger
__construct
(string $name)
-
string
$name: Name of the logger.
Redefined in descendants as:
Adds a new appender to the Logger.
If assertion parameter evaluates as false, then logs the message using the ERROR level.
void
assertLog
([bool $assertion = true], [string $msg = ''])
-
bool
$assertion
-
string
$msg: message to log
Forwards the given logging event to all linked appenders.
Log a message object with the DEBUG level.
void
debug
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.
Log a message object with the ERROR level.
void
error
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.
Log a message object with the FATAL level.
void
fatal
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.
This method creates a new logging event and logs the event without further checks.
It should not be called directly. Use trace(), debug(), info(), warn(), error() and fatal() wrappers.
void
forcedLog
(
string $fqcn,
Exception $throwable,
LoggerLevel $level,
mixed $message)
-
string
$fqcn: Fully qualified class name of the Logger
-
Exception
$throwable: Optional throwable information to include in the logging event.
-
LoggerLevel
$level: log level
-
mixed
$message: message to log
Returns the additivity flag.
boolean
getAdditivity
()
Returns the appenders linked to this logger as an array.
array
getAllAppenders
()
Returns a linked appender by name.
Starting from this Logger, search the Logger hierarchy for a non-null level and return it.
Redefined in descendants as:
Get the assigned Logger level.
Returns the logger name.
string
getName
()
Returns the parent Logger. Can be null if this is the root logger.
Log a message object with the INFO Level.
void
info
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.
Checks whether an appender is attached to this logger instance.
Check whether this Logger is enabled for the DEBUG Level.
boolean
isDebugEnabled
()
Check whether this Logger is enabled for a given Level passed as parameter.
Check whether this Logger is enabled for the ERROR Level.
boolean
isErrorEnabled
()
Check whether this Logger is enabled for the FATAL Level.
boolean
isFatalEnabled
()
Check whether this Logger is enabled for the INFO Level.
boolean
isInfoEnabled
()
Check whether this Logger is enabled for the TRACE Level.
boolean
isTraceEnabled
()
Check whether this Logger is enabled for the WARN Level.
boolean
isWarnEnabled
()
Log a message using the provided logging level.
void
log
(
LoggerLevel $level,
mixed $message, [
Exception $throwable =
null])
-
LoggerLevel
$level: The logging level.
-
mixed
$message: Message to log.
-
Exception
$throwable: Optional throwable information to include in the logging event.
Logs an already prepared logging event object.
Removes all appenders from the Logger.
void
removeAllAppenders
()
Remove the appender passed as parameter form the Logger.
void
removeAppender
(mixed $appender)
Sets the additivity flag.
void
setAdditivity
(boolean $additive)
Set the Logger level.
Use LoggerLevel::getLevelXXX() methods to get a LoggerLevel object, e.g.
-
LoggerLevel
$level: The level to set, or NULL to clear the logger level.
Redefined in descendants as:
-
LoggerRoot::setLevel()
: Override level setter to prevent setting the root logger's level to null. Root logger must always have a level.
Sets the parent logger.
void
setParent
(
Logger $logger)
Redefined in descendants as:
Log a message object with the TRACE level.
void
trace
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.
Log a message with the WARN level.
void
warn
(mixed $message, [Exception $throwable = null])
-
mixed
$message: message
-
Exception
$throwable: Optional throwable information to include in the logging event.