Package com.illumon.iris.db.util.logging
Class BinaryLoggerConfigurationHelpers
java.lang.Object
com.illumon.iris.db.util.logging.BinaryLoggerConfigurationHelpers
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetDefaultLogFormat(int logFormat) Get the log format suffix formatted using "%d".static StringGet an internal partition for binary logging.static StringgetInternalPartitionForLogs(String internalPartitionSuffix, String logFormat, boolean includePid) Determine an appropriate internal partition that can be used for writing logs.static StringGets theLOCAL_INTERNAL_PARTITION_PROPERTYfrom theConfigurationif it is defined.static StringGet the identifier for the local node if it is availablestatic StringgetNodeIdentifier(boolean legalize) Get the identifier for the local host by callingInetAddress.getLocalHost().getHostName()if it is available, optionally legalizing it for use as a partition identifier by replacing dots with underscores.
-
Field Details
-
LOCAL_INTERNAL_PARTITION_PROPERTY
If defined, the value of this property determines the internal partition. SeegetInternalPartitionForLogs(String, String, boolean)for further details.- See Also:
-
FAILOVER_FROM_LAS_ALLOWED_PROP
If this is true, then makeLogger will try to create a non-LAS logger if the LAS isn't working.- See Also:
-
DEFAULT_LOG_FORMAT_SUFFIX_FORMAT
- See Also:
-
-
Constructor Details
-
BinaryLoggerConfigurationHelpers
public BinaryLoggerConfigurationHelpers()
-
-
Method Details
-
getInternalPartitionFromConfig
Gets theLOCAL_INTERNAL_PARTITION_PROPERTYfrom theConfigurationif it is defined. If the property value starts withenv:then the part of the property after that prefix will be used to look up and return an environment variable. For example, if configuring a property value ofenv:NODE_IPthis method will return the value of the NODE_IP environment variable, with all '.' characters replaced with a '_'. Return null if the property is not present, or if there is no environment variable whose name matches the part of the property afterenv:prefix.- Returns:
- The value to be used as the internal partition. Will be null if
LOCAL_INTERNAL_PARTITION_PROPERTYis not defined, or the environment variable it references is not defined.
-
getInternalPartitionForLogs
Get an internal partition for binary logging.If there is a specific internal partition available from configuration (as determined by
getInternalPartitionFromConfig(), use that. Otherwise, use the current node identifier as a partition.- Returns:
- a generic internal partition for binary logging, without awareness of the specific logger
-
getNodeIdentifier
Get the identifier for the local host by callingInetAddress.getLocalHost().getHostName()if it is available, optionally legalizing it for use as a partition identifier by replacing dots with underscores. This will return a Pod name if deployed in a Kubernetes environment.- Parameters:
legalize- if true, modify the return value to be a legal partition string- Returns:
- the local host name, or "UndeterminedHost" if it can't be determined
-
getNodeIdentifier
Get the identifier for the local node if it is available- Returns:
- the local host name, or "UndeterminedHost" if it can't be determined
-
getDefaultLogFormat
Get the log format suffix formatted using "%d". -
getInternalPartitionForLogs
@NotNull @InternalUseOnly public static String getInternalPartitionForLogs(@Nullable String internalPartitionSuffix, @Nullable String logFormat, boolean includePid) Determine an appropriate internal partition that can be used for writing logs. CallsgetInternalPartitionFromConfig()and uses that value, if a config value is present. If not, then the partition will be the value obtained by callinggetNodeIdentifier(), with any period characters replaced with underscores.- Parameters:
includePid- should the process ID of this process be included in the internal partition name. In the standard configuration, when using the LAS or files this is false. When falling back to files from the LAS, this is true so that multiple processes do not create invalid streams.- Returns:
- the internal partition as described above.
-