Package deepnetts.android
Class LoggerContextFactory_Dummy
- java.lang.Object
-
- deepnetts.android.LoggerContextFactory_Dummy
-
- All Implemented Interfaces:
org.apache.logging.log4j.spi.LoggerContextFactory
public class LoggerContextFactory_Dummy extends java.lang.Object implements org.apache.logging.log4j.spi.LoggerContextFactory
- Author:
- Krasimir Topchiyski This factory can be used under Android in order to prevent the default Logging Factory to handle logging events. The default factory uses Java JMX API which is not presented under Android and the code throws ClassNotFoundError. You have to call LogManager.setFactory(new LoggerContextFactory_Dummy()); before any calls to Logger.getLogger(...). The best place for LogManager.setFactory method call is during your android.app.Application instance onCreate method execution.
-
-
Constructor Summary
Constructors Constructor Description LoggerContextFactory_Dummy()
-
Method Summary
Modifier and Type Method Description org.apache.logging.log4j.spi.LoggerContext
getContext(java.lang.String fqcn, java.lang.ClassLoader loader, java.lang.Object externalContext, boolean currentContext)
Creates aLoggerContext
.org.apache.logging.log4j.spi.LoggerContext
getContext(java.lang.String fqcn, java.lang.ClassLoader loader, java.lang.Object externalContext, boolean currentContext, java.net.URI configLocation, java.lang.String name)
Creates aLoggerContext
.void
removeContext(org.apache.logging.log4j.spi.LoggerContext context)
Removes knowledge of a LoggerContext.
-
-
-
Constructor Detail
-
LoggerContextFactory_Dummy
public LoggerContextFactory_Dummy()
-
-
Method Detail
-
getContext
public org.apache.logging.log4j.spi.LoggerContext getContext(java.lang.String fqcn, java.lang.ClassLoader loader, java.lang.Object externalContext, boolean currentContext)
Creates aLoggerContext
.- Specified by:
getContext
in interfaceorg.apache.logging.log4j.spi.LoggerContextFactory
- Parameters:
fqcn
- The fully qualified class name of the caller.loader
- The ClassLoader to use or null.externalContext
- An external context (such as a ServletContext) to be associated with the LoggerContext.currentContext
- If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.- Returns:
- The LoggerContext.
-
getContext
public org.apache.logging.log4j.spi.LoggerContext getContext(java.lang.String fqcn, java.lang.ClassLoader loader, java.lang.Object externalContext, boolean currentContext, java.net.URI configLocation, java.lang.String name)
Creates aLoggerContext
.- Specified by:
getContext
in interfaceorg.apache.logging.log4j.spi.LoggerContextFactory
- Parameters:
fqcn
- The fully qualified class name of the caller.loader
- The ClassLoader to use or null.externalContext
- An external context (such as a ServletContext) to be associated with the LoggerContext.currentContext
- If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.configLocation
- The location of the configuration for the LoggerContext.name
- The name of the context or null.- Returns:
- The LoggerContext.
-
removeContext
public void removeContext(org.apache.logging.log4j.spi.LoggerContext context)
Removes knowledge of a LoggerContext.- Specified by:
removeContext
in interfaceorg.apache.logging.log4j.spi.LoggerContextFactory
- Parameters:
context
- The context to remove.
-
-