Package psiprobe.tools.logging.logback
Class LogbackFactoryAccessor
- java.lang.Object
-
- psiprobe.tools.logging.DefaultAccessor
-
- psiprobe.tools.logging.logback.LogbackFactoryAccessor
-
public class LogbackFactoryAccessor extends DefaultAccessor
Wraps a Logback logger factory from a given web application class loader.All Logback classes are loaded via the given class loader and not via psi-probe's own class loader. For this reasons, all methods on Logback objects are invoked via reflection.
This way, we can even handle different versions of Logback embedded in different WARs.
-
-
Field Summary
-
Fields inherited from class psiprobe.tools.logging.DefaultAccessor
logger
-
-
Constructor Summary
Constructors Constructor Description LogbackFactoryAccessor(ClassLoader cl)
Attempts to initialize a Logback logger factory via the given class loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<LogbackAppenderAccessor>
getAppenders()
Returns a list of wrappers for all Logback appenders that have an associated logger.LogbackLoggerAccessor
getLogger(String name)
Returns the Logback logger with a given name.LogbackLoggerAccessor
getRootLogger()
Returns the Logback root logger.-
Methods inherited from class psiprobe.tools.logging.DefaultAccessor
getApplication, getProperty, getProperty, getTarget, getTargetClass, invokeMethod, setApplication, setTarget
-
-
-
-
Constructor Detail
-
LogbackFactoryAccessor
public LogbackFactoryAccessor(ClassLoader cl) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException
Attempts to initialize a Logback logger factory via the given class loader.- Parameters:
cl
- the ClassLoader to use when fetching the factory- Throws:
ClassNotFoundException
- the class not found exceptionIllegalAccessException
- the illegal access exceptionInvocationTargetException
- the invocation target exception
-
-
Method Detail
-
getRootLogger
public LogbackLoggerAccessor getRootLogger()
Returns the Logback root logger.- Returns:
- the root logger
-
getLogger
public LogbackLoggerAccessor getLogger(String name)
Returns the Logback logger with a given name.- Parameters:
name
- the name- Returns:
- the Logger with the given name
-
getAppenders
public List<LogbackAppenderAccessor> getAppenders()
Returns a list of wrappers for all Logback appenders that have an associated logger.- Returns:
- a list of
LogbackAppenderAccessor
s representing all appenders that are in use
-
-