LoggerHierarchy
LoggerHierarchy
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Property summary
Modifier and Type | Property |
---|---|
protected | loggers |
protected RootLogger | root |
protected RendererMap | rendererMap |
protected LoggerLevel | threshold |
Methods summary
Modifier and Type | Method |
---|---|
public | __construct ( LoggerRoot root ) |
public | clear ( ) |
public boolean | exists ( string name ) |
public array | getCurrentLoggers ( ) |
public Logger | getLogger ( string name ) |
public RendererMap | getRendererMap ( ) |
public LoggerRoot | getRootLogger ( ) |
public LoggerLevel | getThreshold ( ) |
public boolean | isDisabled ( LoggerLevel level ) |
public | resetConfiguration ( ) |
public | setThreshold ( LoggerLevel threshold ) |
public | shutdown ( ) |
public | printHierarchy ( ) |
Properties in detail
-
loggers
protected loggers
-
root
protected RootLogger root
The root logger.var
RootLogger -
rendererMap
protected RendererMap rendererMap
The logger renderer map.var
RendererMap -
threshold
protected LoggerLevel threshold
Main level threshold. Events with lower level will not be logged by any logger, regardless of it's configuration.var
LoggerLevel
Methods in detail
-
__construct
Creates a new logger hierarchy.param
LoggerRoot The root logger. -
clear
public clear ( )Clears all loggers. -
exists
boolean public exists ( string name )Check if the named logger exists in the hierarchy.param
string namereturn
boolean -
getCurrentLoggers
array public getCurrentLoggers ( )Returns all the currently defined loggers in this hierarchy as an array.return
array -
getLogger
Returns a named logger instance logger. If it doesn't exist, one is created. -
getRendererMap
RendererMap public getRendererMap ( )Returns the logger renderer map.return
-
getRootLogger
LoggerRoot public getRootLogger ( )Returns the root logger.return
-
getThreshold
LoggerLevel public getThreshold ( )Returns the main threshold level.return
-
isDisabled
boolean public isDisabled ( LoggerLevel level )Returns true if the hierarchy is disabled for given log level and false otherwise.return
boolean -
resetConfiguration
public resetConfiguration ( )Reset all values contained in this hierarchy instance to their default. This removes all appenders from all loggers, sets the level of all non-root loggers to null, sets their additivity flag to true and sets the level of the root logger to LOGGER_LEVEL_DEBUG.
Existing loggers are not removed. They are just reset.
This method should be used sparingly and with care as it will block all logging until it is completed.
-
setThreshold
public setThreshold ( LoggerLevel threshold )Sets the main threshold level.param
-
shutdown
public shutdown ( )Shutting down a hierarchy will safely close and remove all appenders in all loggers including the root logger. The shutdown method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a logger and again to a nested appender.todo
todo: Check if the last paragraph is correct. -
printHierarchy
public printHierarchy ( )Prints the current \n2n\log4php\Logger hierarchy tree. Useful for debugging.