Class IntradayLoggerBuilder<LOGGER_TYPE extends com.illumon.intradaylogger.IntradayLogger>
public class IntradayLoggerBuilder<LOGGER_TYPE extends com.illumon.intradaylogger.IntradayLogger> extends Object
IntradayLogger
instances, with static helpers for some specific logger
types.
In all cases, this factory will determine the internal partition (or a prefix thereof, if log-format suffixing is
set) through getInternalPartitionForLogs()
.
If binary log files are being written directly (the LAS is not used), the process name will be prefixed to the internal partition name to help distinguish them.
-
Field Summary
Fields Modifier and Type Field Description static String
LOCAL_INTERNAL_PARTITION_PROPERTY
If defined, the value of this property determines the internal partition. -
Constructor Summary
Constructors Constructor Description IntradayLoggerBuilder(Class<LOGGER_TYPE> loggerClass)
Construct a builder for newIntradayLogger
s. -
Method Summary
Modifier and Type Method Description LOGGER_TYPE
makeLogger(com.fishlib.configuration.Configuration configuration, com.fishlib.io.logger.Logger log)
Create anIntradayLogger
and initialize it according to the specified parameters on this builder.IntradayLoggerBuilder<LOGGER_TYPE>
setColumnPartitionFunction(Function<?,String> columnPartitionFunction)
Set a function to be used to compute the column partition value for function-based column partition determination.IntradayLoggerBuilder<LOGGER_TYPE>
setColumnPartitionValue(String columnPartitionValue)
Set the column partition value to be used.IntradayLoggerBuilder<LOGGER_TYPE>
setForceUseLas(boolean forceUseLas)
Set whether to always use the log aggregator service (LAS).IntradayLoggerBuilder<LOGGER_TYPE>
setNamespace(String namespace)
Set the namespace for the new logger if the logger's default should not be used.IntradayLoggerBuilder<LOGGER_TYPE>
setNamespaceSet(TableIdentifier.NamespaceSet namespaceSet)
Set theTableIdentifier.NamespaceSet
(USER or SYSTEM) for the logger.IntradayLoggerBuilder<LOGGER_TYPE>
setProcessName(String processName)
Set property prefix to be used for log creation and initialization.IntradayLoggerBuilder<LOGGER_TYPE>
setStandalone(boolean standalone)
Set whether to skip logger checksum verification, appropriate for logging processes that cannot contact a remote schema service.IntradayLoggerBuilder<LOGGER_TYPE>
setSuffixInternalPartitionWithLogFormat(boolean suffixInternalPartitionWithLogFormat)
Set whether to suffix internal partitions with the log format.IntradayLoggerBuilder<LOGGER_TYPE>
setTableName(String tableName)
Set the table name for the new logger, if the logger's default should not be used.IntradayLoggerBuilder<LOGGER_TYPE>
setTimeZoneName(String timeZoneName)
Set the name of the time zone to be used to determine column partition values and file name date-time stamps.
-
Field Details
-
LOCAL_INTERNAL_PARTITION_PROPERTY
If defined, the value of this property determines the internal partition. SeegetInternalPartitionForLogs()
for further details.- See Also:
- Constant Field Values
-
-
Constructor Details
-
IntradayLoggerBuilder
Construct a builder for newIntradayLogger
s.- Parameters:
loggerClass
- TheIntradayLogger
Class
to be instantiated
-
-
Method Details
-
setProcessName
Set property prefix to be used for log creation and initialization. Required.- Parameters:
processName
- Property prefix to be used for log creation and initialization- Returns:
- This builder.
-
setNamespaceSet
public IntradayLoggerBuilder<LOGGER_TYPE> setNamespaceSet(@NotNull TableIdentifier.NamespaceSet namespaceSet)Set theTableIdentifier.NamespaceSet
(USER or SYSTEM) for the logger. Defaults toTableIdentifier.NamespaceSet.SYSTEM
Required.- Parameters:
namespaceSet
- TheTableIdentifier.NamespaceSet
for the logger- Returns:
- This builder.
-
setNamespace
Set the namespace for the new logger if the logger's default should not be used. Optional.- Parameters:
namespace
- The namespace for the new logger- Returns:
- This builder.
-
setTableName
Set the table name for the new logger, if the logger's default should not be used. Optional.- Parameters:
tableName
- The table name for the new logger- Returns:
- This builder.
-
setTimeZoneName
Set the name of the time zone to be used to determine column partition values and file name date-time stamps. Optional.If none is provided the system default will be used.
This is ignored for non-dynamic loggers using the log aggregator service.
Superceded when a column partition function or a column partition value is set and used.
- Parameters:
timeZoneName
- The time zone name- Returns:
- This builder.
-
setColumnPartitionFunction
public IntradayLoggerBuilder<LOGGER_TYPE> setColumnPartitionFunction(@Nullable Function<?,String> columnPartitionFunction)Set a function to be used to compute the column partition value for function-based column partition determination. Optional.Superceded when a column partition value is set and used.
- Parameters:
columnPartitionFunction
- The column partition function- Returns:
- This builder.
-
setColumnPartitionValue
public IntradayLoggerBuilder<LOGGER_TYPE> setColumnPartitionValue(@Nullable String columnPartitionValue)Set the column partition value to be used. Optional.- Parameters:
columnPartitionValue
- The column partition value- Returns:
- This builder.
-
setForceUseLas
Set whether to always use the log aggregator service (LAS). Defaults to false. Optional.- Parameters:
forceUseLas
- Whether to force use of the log aggregator service (LAS)- Returns:
- This builder.
-
setStandalone
Set whether to skip logger checksum verification, appropriate for logging processes that cannot contact a remote schema service. Defaults to false. Optional.- Parameters:
standalone
- Whether to skip logger checksum verification- Returns:
- This builder.
-
setSuffixInternalPartitionWithLogFormat
public IntradayLoggerBuilder<LOGGER_TYPE> setSuffixInternalPartitionWithLogFormat(boolean suffixInternalPartitionWithLogFormat)Set whether to suffix internal partitions with the log format. Defaults to false. Optional.Example: If the internal partition would normally have been "ABC" and the logger format is version 4, the actual partition used would be: "ABC-4".
- Parameters:
suffixInternalPartitionWithLogFormat
- Whether to suffix the internal partition with logger format- Returns:
- This builder.
-
makeLogger
public LOGGER_TYPE makeLogger(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull com.fishlib.io.logger.Logger log)Create anIntradayLogger
and initialize it according to the specified parameters on this builder.- If a columnPartitionValue is provided, it will be used for all rows, regardless of any specified dynamic partition properties or provided columnPartitionFunction.
- If no columnPartitionValue is provided, the column partition value will be determined either by the date when the logged row is written using the specified time zone, or determined dynamically from the schema and data if the properties specify this (loggerClass.useDynamicPartitions, or processName.useDynamicPartitions=true, or loggerClass.processName.useDynamicPartitions=true).
- The rows will be written directly to binary log files unless the properties specify to use the log aggregator service (processName.useLogAggregatorService=true or loggerClass.processName.useLogAggregatorService=true) or forceUseLas is true.
- Parameters:
configuration
-Configuration
instance for property lookuplog
-Logger
to be used duringIntradayLogger
initialization- Returns:
- An initialized
IntradayLogger
.
-