Package co.elastic.apm.agent.logging
Class LoggingConfiguration
- java.lang.Object
-
- org.stagemonitor.configuration.ConfigurationOptionProvider
-
- co.elastic.apm.agent.logging.LoggingConfiguration
-
public class LoggingConfiguration extends org.stagemonitor.configuration.ConfigurationOptionProviderDefines configuration options related to logging.This class is a bit special compared to other
ConfigurationOptionProviders, because we have to make sure that wie initialize the logger before anyone callsLoggerFactory.getLogger(Class). That's why we don't read the values from theConfigurationOptionfields but iterate over theConfigurationSources manually to read the values (seeLog4j2ConfigurationFactory.getValue(java.lang.String, java.util.List<org.stagemonitor.configuration.source.ConfigurationSource>, java.lang.String)).It still makes sense to extend
ConfigurationOptionProviderand register this class as a service, so that the documentation gets generated for the options in this class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAGENT_HOME_PLACEHOLDERstatic java.lang.StringDEFAULT_MAX_SIZEstatic java.lang.StringLOG_FORMAT_FILE_KEYorg.stagemonitor.configuration.ConfigurationOption<java.lang.String>logFileorg.stagemonitor.configuration.ConfigurationOption<ByteValue>logFileSizeorg.stagemonitor.configuration.ConfigurationOption<LogFormat>logFormatFileorg.stagemonitor.configuration.ConfigurationOption<LogFormat>logFormatSoutorg.stagemonitor.configuration.ConfigurationOption<co.elastic.apm.agent.logging.LogLevel>logLevelWe don't directly access most logging configuration values through the ConfigurationOption instance variables.static java.lang.StringSYSTEM_OUT
-
Constructor Summary
Constructors Constructor Description LoggingConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<WildcardMatcher>getLogEcsFormatterAllowList()java.lang.StringgetLogEcsFormattingDestinationDir()LogEcsReformattinggetLogEcsReformatting()java.lang.StringgetLogFile()longgetLogFileSize()LogFormatgetLogFormatFile()static voidinit(java.util.List<org.stagemonitor.configuration.source.ConfigurationSource> sources, java.lang.String ephemeralId)booleanisLogCorrelationEnabled()booleanisShipAgentLogs()
-
-
-
Field Detail
-
SYSTEM_OUT
public static final java.lang.String SYSTEM_OUT
- See Also:
- Constant Field Values
-
AGENT_HOME_PLACEHOLDER
public static final java.lang.String AGENT_HOME_PLACEHOLDER
- See Also:
- Constant Field Values
-
DEFAULT_MAX_SIZE
public static final java.lang.String DEFAULT_MAX_SIZE
- See Also:
- Constant Field Values
-
LOG_FORMAT_FILE_KEY
public static final java.lang.String LOG_FORMAT_FILE_KEY
- See Also:
- Constant Field Values
-
logLevel
public org.stagemonitor.configuration.ConfigurationOption<co.elastic.apm.agent.logging.LogLevel> logLevel
We don't directly access most logging configuration values through the ConfigurationOption instance variables. That would require the configuration registry to be initialized already. However, the registry initializes logging by declaring a static final logger variable. In order to break up the cyclic dependency and to not accidentally initialize logging before we had the chance to configure the logging, we manually resolve these options. NOTE: on top of the above, this specific option should never be accessed through the ConfigurationOption as it allowsLogLevelthat are effectively mapped to other values. SeeLog4j2ConfigurationFactory.getValue(java.lang.String, java.util.List<org.stagemonitor.configuration.source.ConfigurationSource>, java.lang.String)
-
logFile
public org.stagemonitor.configuration.ConfigurationOption<java.lang.String> logFile
-
logFileSize
public org.stagemonitor.configuration.ConfigurationOption<ByteValue> logFileSize
-
logFormatSout
public org.stagemonitor.configuration.ConfigurationOption<LogFormat> logFormatSout
-
logFormatFile
public org.stagemonitor.configuration.ConfigurationOption<LogFormat> logFormatFile
-
-
Method Detail
-
init
public static void init(java.util.List<org.stagemonitor.configuration.source.ConfigurationSource> sources, java.lang.String ephemeralId)
-
getLogFile
public java.lang.String getLogFile()
-
isLogCorrelationEnabled
public boolean isLogCorrelationEnabled()
-
getLogEcsReformatting
public LogEcsReformatting getLogEcsReformatting()
-
getLogEcsFormatterAllowList
public java.util.List<WildcardMatcher> getLogEcsFormatterAllowList()
-
getLogEcsFormattingDestinationDir
@Nullable public java.lang.String getLogEcsFormattingDestinationDir()
-
getLogFileSize
public long getLogFileSize()
-
isShipAgentLogs
public boolean isShipAgentLogs()
-
getLogFormatFile
public LogFormat getLogFormatFile()
-
-