java.lang.Object
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory
org.apache.logging.log4j.core.config.ConfigurationFactory
net.luis.utils.logging.factory.SpringFactory
@Plugin(name="SpringFactory",
category="ConfigurationFactory")
public class SpringFactory
extends org.apache.logging.log4j.core.config.ConfigurationFactory
Spring logging configuration factory.
Due to the fact that spring boot replaces the logging configuration with its own,
this factory is used to replace the spring boot configuration with the logger configuration used before spring boot.
Due to the fact that spring boot replaces the logging configuration with its own,
this factory is used to replace the spring boot configuration with the logger configuration used before spring boot.
This factory must be registered via the system property 'log4j.configurationFactory'
with the fully qualified class name as its value.
Alternatively, the factory can be registered by calling LoggingUtils.registerSpringFactory()
.
-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.config.ConfigurationFactory
AUTHORIZATION_PROVIDER, CATEGORY, CONFIGURATION_FACTORY_PROPERTY, CONFIGURATION_FILE_PROPERTY, DEFAULT_PREFIX, LOG4J1_CONFIGURATION_FILE_PROPERTY, LOG4J1_EXPERIMENTAL, LOG4J1_VERSION, LOG4J2_VERSION, LOGGER, substitutor, TEST_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate @NotNull org.apache.logging.log4j.core.config.Configuration
Creates a new configuration with no additional changes.@NotNull org.apache.logging.log4j.core.config.Configuration
getConfiguration
(@NotNull org.apache.logging.log4j.core.LoggerContext context, @NotNull String name, @NotNull URI location) @NotNull org.apache.logging.log4j.core.config.Configuration
getConfiguration
(@NotNull org.apache.logging.log4j.core.LoggerContext context, @NotNull org.apache.logging.log4j.core.config.ConfigurationSource source) protected String @NotNull []
Returns the supported file extensions of the factory.
The factory does not depend on the file extension, so it supports all file extensions.Methods inherited from class org.apache.logging.log4j.core.config.ConfigurationFactory
authorizationProvider, getAuthorizationProvider, getConfiguration, getDefaultPrefix, getInputFromString, getInstance, getTestPrefix, getVersion, isActive, removeConfigurationFactory, resetConfigurationFactory, setConfigurationFactory
Methods inherited from class org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory
newConfigurationBuilder, newConfigurationBuilder
-
Constructor Details
-
SpringFactory
public SpringFactory()Constructs a new spring factory for logging configuration.
-
-
Method Details
-
getSupportedTypes
Returns the supported file extensions of the factory.
The factory does not depend on the file extension, so it supports all file extensions.- Specified by:
getSupportedTypes
in classorg.apache.logging.log4j.core.config.ConfigurationFactory
- Returns:
- The supported file extensions
-
defaultConfiguration
@NotNull private @NotNull org.apache.logging.log4j.core.config.Configuration defaultConfiguration()Creates a new configuration with no additional changes.- Returns:
- The default configuration
-
getConfiguration
@NotNull public @NotNull org.apache.logging.log4j.core.config.Configuration getConfiguration(@NotNull @NotNull org.apache.logging.log4j.core.LoggerContext context, @NotNull @NotNull org.apache.logging.log4j.core.config.ConfigurationSource source) - Specified by:
getConfiguration
in classorg.apache.logging.log4j.core.config.ConfigurationFactory
- Parameters:
context
- The logger contextsource
- The configuration source- Returns:
- The configuration used before spring boot or the default configuration if none is cached
-
getConfiguration
@NotNull public @NotNull org.apache.logging.log4j.core.config.Configuration getConfiguration(@NotNull @NotNull org.apache.logging.log4j.core.LoggerContext context, @NotNull @NotNull String name, @NotNull @NotNull URI location) - Overrides:
getConfiguration
in classorg.apache.logging.log4j.core.config.ConfigurationFactory
- Parameters:
context
- The logger contextname
- The configuration name.location
- The configuration location.- Returns:
- The configuration used before spring boot or the default configuration if none is cached
-