Top Description Methods
org.apache.logging.log4j.spi

public Interface LoggerContextFactory

Known Direct Implementers
org.apache.logging.log4j.simple.SimpleLoggerContextFactory
Imports
java.net.URI

Implemented by factories that create LoggerContext objects.

Method Summary

Modifier and TypeMethod and Description
public LoggerContext

Returns:

The LoggerContext.
getContext
(String
The fully qualified class name of the caller.
fqcn
,
ClassLoader
The ClassLoader to use or null.
loader
,
Object
An external context (such as a ServletContext) to be associated with the LoggerContext.
externalContext
,
boolean
If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.
currentContext
)

Creates a LoggerContext.

public LoggerContext

Returns:

The LoggerContext.
getContext
(String
The fully qualified class name of the caller.
fqcn
,
ClassLoader
The ClassLoader to use or null.
loader
,
Object
An external context (such as a ServletContext) to be associated with the LoggerContext.
externalContext
,
boolean
If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.
currentContext
,
URI
The location of the configuration for the LoggerContext.
configLocation
,
String
The name of the context or null.
name
)

Creates a LoggerContext.

public default boolean

Returns:

true if a LoggerContext has been installed, false otherwise.
hasContext
(String
The fully qualified class name of the caller.
fqcn
,
ClassLoader
The ClassLoader to use or null.
loader
,
boolean
If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.
currentContext
)

Checks to see if a LoggerContext is installed.

public default boolean
isClassLoaderDependent()

Determines whether or not this factory and perhaps the underlying ContextSelector behavior depend on the callers classloader.

public void
removeContext(LoggerContext
The context to remove.
context
)

Removes knowledge of a LoggerContext.

public default void
shutdown(String
The fully qualified class name of the caller.
fqcn
,
ClassLoader
The ClassLoader to use or null.
loader
,
boolean
If true shuts down the current Context, if false shuts down the Context appropriate for the caller if a more appropriate Context can be determined.
currentContext
,
boolean
if true all LoggerContexts that can be located will be shutdown.
allContexts
)

Shuts down the LoggerContext.

Method Detail

getContextback to summary
public LoggerContext getContext(String fqcn, ClassLoader loader, Object externalContext, boolean currentContext)

Creates a LoggerContext.

Parameters
fqcn:String

The fully qualified class name of the caller.

loader:ClassLoader

The ClassLoader to use or null.

externalContext:Object

An external context (such as a ServletContext) to be associated with the LoggerContext.

currentContext:boolean

If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.

Returns:LoggerContext

The LoggerContext.

getContextback to summary
public LoggerContext getContext(String fqcn, ClassLoader loader, Object externalContext, boolean currentContext, URI configLocation, String name)

Creates a LoggerContext.

Parameters
fqcn:String

The fully qualified class name of the caller.

loader:ClassLoader

The ClassLoader to use or null.

externalContext:Object

An external context (such as a ServletContext) to be associated with the LoggerContext.

currentContext:boolean

If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.

configLocation:URI

The location of the configuration for the LoggerContext.

name:String

The name of the context or null.

Returns:LoggerContext

The LoggerContext.

hasContextback to summary
public default boolean hasContext(String fqcn, ClassLoader loader, boolean currentContext)

Checks to see if a LoggerContext is installed. The default implementation returns false.

Parameters
fqcn:String

The fully qualified class name of the caller.

loader:ClassLoader

The ClassLoader to use or null.

currentContext:boolean

If true returns the current Context, if false returns the Context appropriate for the caller if a more appropriate Context can be determined.

Returns:boolean

true if a LoggerContext has been installed, false otherwise.

Since
2.13.0
isClassLoaderDependentback to summary
public default boolean isClassLoaderDependent()

Determines whether or not this factory and perhaps the underlying ContextSelector behavior depend on the callers classloader. This method should be overridden by implementations, however a default method is provided which always returns true to preserve the old behavior.

Since
2.15.0
removeContextback to summary
public void removeContext(LoggerContext context)

Removes knowledge of a LoggerContext.

Parameters
context:LoggerContext

The context to remove.

shutdownback to summary
public default void shutdown(String fqcn, ClassLoader loader, boolean currentContext, boolean allContexts)

Shuts down the LoggerContext.

Parameters
fqcn:String

The fully qualified class name of the caller.

loader:ClassLoader

The ClassLoader to use or null.

currentContext:boolean

If true shuts down the current Context, if false shuts down the Context appropriate for the caller if a more appropriate Context can be determined.

allContexts:boolean

if true all LoggerContexts that can be located will be shutdown.

Since
2.13.0