Class Logger

Description

This is the central class in the log4j package. Most logging operations, except configuration, are done through this class.

In log4j this class replaces the Category class. There is no need to port deprecated classes; log4php Logger class doesn't extend Category.

Located in /Logger.php (line 53)


	
			
Direct descendents
Class Description
LoggerRoot The root logger.
Method Summary
static void autoload (string $className)
static boolean clear ()
static void configure ([String $configurationFile = null], [String $configurationClass = null])
static boolean exists (string $name)
static the getConfigurationClass ()
static the getConfigurationFile ()
static array getCurrentLoggers ()
static Logger getLogger (string $name, LoggerFactory $factory)
static boolean initialize ()
static boolean resetConfiguration ()
static void shutdown ()
Logger __construct (string $name)
void addAppender (LoggerAppender $newAppender)
void assertLog ([bool $assertion = true], [string $msg = ''])
void debug (mixed $message, [mixed $caller = null])
void error (mixed $message, [mixed $caller = null])
void fatal (mixed $message, [mixed $caller = null])
void forcedLog (string $fqcn, mixed $caller, LoggerLevel $level, mixed $message)
boolean getAdditivity ()
array getAllAppenders ()
string getName ()
void info (mixed $message, [mixed $caller = null])
void isAttached (LoggerAppender $appender)
boolean isDebugEnabled ()
boolean isEnabledFor (LoggerLevel $level)
boolean isInfoEnabled ()
void log (LoggerLevel $priority, mixed $message, [mixed $caller = null])
void removeAppender (mixed $appender)
void setAdditivity (boolean $additive)
void setLevel (LoggerLevel $level)
void setParent (Logger $logger)
void warn (mixed $message, [mixed $caller = null])
Methods
static autoload (line 125)

Class autoloader This method is provided to be invoked within an __autoload() magic method.

  • access: public
static void autoload (string $className)
  • string $className: class name
static clear (line 479)

Clears all logger definitions

  • access: public
static boolean clear ()
static configure (line 571)

Configures Log4PHP.

This method needs to be called before the first logging event has occured. If this methode is never called, the standard configuration takes place (@see LoggerConfiguratorBasic). If only the configuration file is given, the configurator class will be the XML Configurator or the INI Configurator, if no .xml ending could be determined.

If a custom configurator should be used, the configuration file is either null or the path to file the custom configurator uses. Make sure the configurator is already or can be loaded by PHP when necessary.

  • access: public
static void configure ([String $configurationFile = null], [String $configurationClass = null])
  • String $configurationFile: the configuration file
  • String $configurationClass: the configurator class
static exists (line 515)

check if a given logger exists.

  • access: public
static boolean exists (string $name)
  • string $name: logger name
static getConfigurationClass (line 597)

Returns the current configurator

  • return: configurator
  • access: public
static the getConfigurationClass ()
static getConfigurationFile (line 605)

Returns the current configuration file

  • return: configuration file
  • access: public
static the getConfigurationFile ()
static getCurrentLoggers (line 526)

Returns an array this whole Logger instances.

static array getCurrentLoggers ()
static getHierarchy (line 201)

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.

  • deprecated: - will be moved to private
  • access: public
static LoggerHierarchy getHierarchy ()
static getLogger (line 345)

Get a Logger by name (Delegate to Logger)

  • access: public
static Logger getLogger (string $name, LoggerFactory $factory)
  • string $name: logger name
  • LoggerFactory $factory: a LoggerFactory instance or null
static getRootLogger (line 357)

get the Root Logger (Delegate to Logger)

  • access: public
static LoggerRoot getRootLogger ()
static initialize (line 620)

Initializes the log4php framework.

  • access: public
static boolean initialize ()
static resetConfiguration (line 489)

Destroy configurations for logger definitions

  • access: public
static boolean resetConfiguration ()
static shutdown (line 504)

Safely close all appenders.

This is not longer necessary due the appenders shutdown via destructors.

  • deprecated:
  • access: public
static void shutdown ()
Constructor __construct (line 172)

Constructor.

  • access: public
Logger __construct (string $name)
  • string $name: Category name

Redefined in descendants as:
addAppender (line 371)

Add a new Appender to the list of appenders of this Category instance.

  • access: public
void addAppender (LoggerAppender $newAppender)
assertLog (line 323)

If assertion parameter is false, then logs msg as an error statement.

  • access: public
void assertLog ([bool $assertion = true], [string $msg = ''])
  • bool $assertion
  • string $msg: message to log
callAppenders (line 407)

Call the appenders in the hierarchy starting at this.

  • access: public
void callAppenders (LoggerLoggingEvent $event)
debug (line 215)

Log a message object with the DEBUG level including the caller.

  • access: public
void debug (mixed $message, [mixed $caller = null])
  • mixed $message: message
  • mixed $caller: caller object or caller string id
error (line 246)

Log a message object with the ERROR level including the caller.

  • access: public
void error (mixed $message, [mixed $caller = null])
  • mixed $message: message
  • mixed $caller: caller object or caller string id
fatal (line 256)

Log a message object with the FATAL level including the caller.

  • access: public
void fatal (mixed $message, [mixed $caller = null])
  • mixed $message: message
  • mixed $caller: caller object or caller string id
forcedLog (line 272)

This method creates a new logging event and logs the event without further checks.

It should not be called directly. Use info(), debug(), warn(), error() and fatal() wrappers.

void forcedLog (string $fqcn, mixed $caller, LoggerLevel $level, mixed $message)
  • string $fqcn: Fully Qualified Class Name of the Logger
  • mixed $caller: caller object or caller string id
  • LoggerLevel $level: log level
  • mixed $message: message
getAdditivity (line 438)

Get the additivity flag for this Category instance.

  • access: public
boolean getAdditivity ()
getAllAppenders (line 422)

Get the appenders contained in this category as an array.

  • return: collection of appenders
  • access: public
array getAllAppenders ()
getAppender (line 430)

Look for the appender named as name.

  • access: public
LoggerAppender getAppender ( $name)
  • $name
getEffectiveLevel (line 447)

Starting from this category, search the category hierarchy for a non-null level and return it.

LoggerLevel getEffectiveLevel ()
getLevel (line 460)

Returns the assigned Level, if any, for this Category.

  • return: or null
  • access: public
LoggerLevel getLevel ()
getName (line 180)

Return the category name.

  • access: public
string getName ()
getParent (line 188)

Returns the parent of this category.

  • access: public
Logger getParent ()
info (line 226)

Log a message object with the INFO Level.

  • access: public
void info (mixed $message, [mixed $caller = null])
  • mixed $message: message
  • mixed $caller: caller object or caller string id
isAttached (line 535)

Is the appender passed as parameter attached to this category?

  • access: public
void isAttached (LoggerAppender $appender)
isDebugEnabled (line 281)

Check whether this category is enabled for the DEBUG Level.

  • access: public
boolean isDebugEnabled ()
isEnabledFor (line 291)

Check whether this category is enabled for a given Level passed as parameter.

  • access: public
boolean isEnabledFor (LoggerLevel $level)
isInfoEnabled (line 300)

Check whether this category is enabled for the info Level.

boolean isInfoEnabled ()
log (line 311)

This generic form is intended to be used by wrappers.

  • access: public
void log (LoggerLevel $priority, mixed $message, [mixed $caller = null])
  • LoggerLevel $priority: a valid level
  • mixed $message: message
  • mixed $caller: caller object or caller string id
removeAllAppenders (line 379)

Remove all previously added appenders from this Category instance.

  • access: public
void removeAllAppenders ()
removeAppender (line 392)

Remove the appender passed as parameter form the list of appenders.

  • access: public
void removeAppender (mixed $appender)
setAdditivity (line 544)

Set the additivity flag for this Category instance.

  • access: public
void setAdditivity (boolean $additive)
  • boolean $additive
setLevel (line 469)

Set the level of this Category.

  • access: public
void setLevel (LoggerLevel $level)
  • LoggerLevel $level: a level string or a level constant

Redefined in descendants as:
  • LoggerRoot::setLevel() : Setting a null value to the level of the root category may have catastrophic results.
setParent (line 551)

Sets the parent logger of this logger

  • access: public
void setParent (Logger $logger)

Redefined in descendants as:
warn (line 236)

Log a message with the WARN level.

  • access: public
void warn (mixed $message, [mixed $caller = null])
  • mixed $message: message
  • mixed $caller: caller object or caller string id

Documentation generated on Fri, 27 Nov 2009 07:44:45 +0100 by phpDocumentor 1.4.3