| org.objectweb.util.monolog.wrapper.log4j.MonologCategory
MonologCategory | public class MonologCategory extends org.apache.log4j.Logger implements TopicalLogger(Code) | | This class wraps the Logger concept into the log4j world. This class extends
therefore the Logger class. This implementation supports
- The multiple topic feature by adding a parent list into each node.
- The inheritance model: The same instance represents the monolog aspect
(Logger) and the Log4j aspect (Logger).
- The delegation model: There are two instances, a Logger object (or a
class which inherits from Logger as RootLogger), and a MonologCategory
which delegates calls to the first objects.
author: Sebastien Chassande-Barrioz |
Inner Class :public static class OwPriority extends org.apache.log4j.Level | |
Inner Class :public static class BetaCF implements org.apache.log4j.spi.LoggerFactory | |
Field Summary | |
final protected static int | DISABLE_OFF | final protected static int | DISABLE_ON | protected ArrayList | appenders | protected org.apache.log4j.Logger | categ This field references the inner Logger if the delegation was choosen. | protected byte | depth | protected boolean | enable | protected OwPriority | interPriority | protected HashMap | topicToparents This field references all parent of this Logger.
key = topic of the current logger
value = its parent either the topic. |
Constructor Summary | |
public | MonologCategory(String _initialName) This constructor initializes the instance in inheritance mode. | public | MonologCategory(org.apache.log4j.Logger c) This constructor initializes the instance in delegation mode.
Parameters: c - is the inner Logger. |
Method Summary | |
public void | addHandler(Handler h) | public void | addTopic(String topic) | public void | callAppenders(LoggingEvent event) In inheritance mode this method delegates the treatment to the other
callAppendes methods. | public synchronized boolean | callAppenders(LoggingEvent event, boolean called) This method calls all the parent loggers and call its appender either
the followin condition:
- if the called parameter is equals to true then all parent are call
with the same value, and the logging event are transmitted to the
appenders.
| public static String | format(String msg, int removeTopStack) It formats a message by adding the object and the method name where the
call to monolog was done.
Parameters: msg - is the original message Parameters: removeTopStack - is the number of monolog method call. | public Object | getAttribute(String name) | public String[] | getAttributeNames() | public org.apache.log4j.Level | getChainedLevel() Starting from this Logger, search the Logger hierarchy for a
non-null priority and return it. | public int | getCurrentIntLevel() | public Level | getCurrentLevel() | public Handler[] | getHandler() | public Handler | getHandler(String hn) | public String[] | getTopic() | public Enumeration | getTopics() | public String | getType() | public boolean | isLoggable(int l) | public boolean | isLoggable(Level l) | public boolean | isOn() | public void | log(int l, Object o) Log an object with a specific level. | public void | log(Level l, Object o) | public void | log(int l, Object o, Throwable t) Log an object and a trowable with a specific level. | public void | log(Level l, Object o, Throwable t) | public void | log(int l, Object o, Object location, Object method) Log an object and a trowable with a specific level. | public void | log(Level l, Object o, Object location, Object method) | public void | log(int l, Object o, Throwable t, Object location, Object method) Log an object and a trowable with a specific level. | public void | log(Level l, Object o, Throwable t, Object location, Object method) | public void | removeAllHandlers() | public void | removeHandler(Handler h) | public void | removeTopic(String topic) | public Object | setAttribute(String name, Object value) | public void | setIntLevel(int level) | public void | setLevel(Level l) | public void | setName(String n) | public void | turnOff() | public void | turnOn() |
DISABLE_OFF | final protected static int DISABLE_OFF(Code) | | |
DISABLE_ON | final protected static int DISABLE_ON(Code) | | |
appenders | protected ArrayList appenders(Code) | | This field references all appenders associated to the current Logger
|
categ | protected org.apache.log4j.Logger categ(Code) | | This field references the inner Logger if the delegation was choosen.
|
depth | protected byte depth(Code) | | |
enable | protected boolean enable(Code) | | |
interPriority | protected OwPriority interPriority(Code) | | |
topicToparents | protected HashMap topicToparents(Code) | | This field references all parent of this Logger.
key = topic of the current logger
value = its parent either the topic. A parent can be a MonologCategory or
a Logger.
|
MonologCategory | public MonologCategory(String _initialName)(Code) | | This constructor initializes the instance in inheritance mode. It
initializes the instanceFQN, and struture of parents.
|
MonologCategory | public MonologCategory(org.apache.log4j.Logger c)(Code) | | This constructor initializes the instance in delegation mode.
Parameters: c - is the inner Logger. All calls will be foward to this instance |
addHandler | public void addHandler(Handler h) throws Exception(Code) | | Add a handler in the Handler list of the topicalLogger
|
callAppenders | public void callAppenders(LoggingEvent event)(Code) | | In inheritance mode this method delegates the treatment to the other
callAppendes methods.
In delegation mode, the call is forwarded on the inner Logger instance.
|
callAppenders | public synchronized boolean callAppenders(LoggingEvent event, boolean called)(Code) | | This method calls all the parent loggers and call its appender either
the followin condition:
- if the called parameter is equals to true then all parent are call
with the same value, and the logging event are transmitted to the
appenders. The true is return beacause the event must be transmitted
- Or if the current priority is define and the message priority is
equals or greater then the current priority then all parent are call
with the same value, and the logging event are transmitted to the
appenders. The true is return beacause the event must be transmitted
- Else It is needed to check one of the parent is enable for the
logging event. This is done by the recall of each parent. If one of the
parent return true, then the event must be logged.
Parameters: event - is the logging event Parameters: called - is the boolean which permits to know if the current logger mustcall or not its appender without check its priority.return true is the logging event is enabled in the current logger or oneof its ancestors. |
format | public static String format(String msg, int removeTopStack)(Code) | | It formats a message by adding the object and the method name where the
call to monolog was done.
Parameters: msg - is the original message Parameters: removeTopStack - is the number of monolog method call. Indeed this methodfetch a stack trace. This method fetches one line in this stack. Theparameter is the line number in this stack. |
getChainedLevel | public org.apache.log4j.Level getChainedLevel()(Code) | | Starting from this Logger, search the Logger hierarchy for a
non-null priority and return it. Otherwise, return the priority of the
root Logger.
The Logger class is designed so that this method executes as
quickly as possible.
|
getCurrentIntLevel | public int getCurrentIntLevel()(Code) | | Return the current Level of the logger
|
getTopic | public String[] getTopic()(Code) | | Returns the list of the different names of the topicalLogger
|
getTopics | public Enumeration getTopics()(Code) | | Returns the list of the different names of the topicalLogger
|
isLoggable | public boolean isLoggable(int l)(Code) | | Check if the level parameter are not filtered by the logger
|
isOn | public boolean isOn()(Code) | | Is the handler enabled
|
log | public void log(int l, Object o)(Code) | | Log an object with a specific level. If the level parameter is
loggable the object is handled.
|
log | public void log(int l, Object o, Throwable t)(Code) | | Log an object and a trowable with a specific level.
|
log | public void log(int l, Object o, Object location, Object method)(Code) | | Log an object and a trowable with a specific level. This method
permits to specify an object instance and a method.
|
log | public void log(int l, Object o, Throwable t, Object location, Object method)(Code) | | Log an object and a trowable with a specific level. This method
permits to specify an object instance and a method.
|
removeHandler | public void removeHandler(Handler h) throws Exception(Code) | | Remove a handler from the Handler list of the topicalLogger
|
removeTopic | public void removeTopic(String topic) throws Exception(Code) | | Remove a topic from the topicalLogger
|
setIntLevel | public void setIntLevel(int level)(Code) | | Set the current level of the logger
|
turnOff | public void turnOff()(Code) | | Disable the handler
|
turnOn | public void turnOn()(Code) | | Enable the handler
|
|
|