public class MeterConfig extends Object
Meter and MeterData.
This class exposes a set of flags and properties that determine the behavior of meters, such as progress reporting, logging categories, and encoded data handling. These properties can be configured at application startup or modified dynamically at runtime.
These properties should ideally be defined before invoking any method from this library, to ensure consistent behavior. Some properties can be modified dynamically at runtime, although care should be taken in concurrent environments.
Performance note: Some properties, such as progress reporting intervals, may impact performance if configured with very low values.
This class is a utility holder and should not be instantiated.
| Modifier and Type | Field and Description |
|---|---|
String |
dataPrefix
Prefix added to the logger name used for encoded data messages.
|
String |
dataSuffix
Suffix added to the logger name used for encoded data messages.
|
String |
messagePrefix
Prefix added to the logger name used for human-readable messages.
|
String |
messageSuffix
Suffix added to the logger name used for human-readable messages.
|
boolean |
printCategory
Whether the meter includes the category in readable messages.
|
boolean |
printLoad
Whether the meter includes the CPU load in readable messages.
|
boolean |
printMemory
Whether the meter includes the memory load in readable messages.
|
boolean |
printPosition
Whether the meter includes the position (event counter) in readable messages.
|
boolean |
printStatus
Whether the meter includes the status in readable messages.
|
long |
progressPeriodMilliseconds
Time to wait before reporting the next progress status, in milliseconds.
|
String |
PROP_DATA_PREFIX |
String |
PROP_DATA_SUFFIX |
String |
PROP_MESSAGE_PREFIX |
String |
PROP_MESSAGE_SUFFIX |
String |
PROP_PRINT_CATEGORY |
String |
PROP_PRINT_LOAD |
String |
PROP_PRINT_MEMORY |
String |
PROP_PRINT_POSITION |
String |
PROP_PRINT_STATUS |
String |
PROP_PROGRESS_PERIOD |
| Constructor and Description |
|---|
MeterConfig() |
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Initializes the configuration attributes by reading the corresponding system properties.
|
public final String PROP_MESSAGE_SUFFIX
public final String PROP_MESSAGE_PREFIX
public final String PROP_DATA_SUFFIX
public final String PROP_DATA_PREFIX
public final String PROP_PRINT_MEMORY
public final String PROP_PRINT_CATEGORY
public final String PROP_PRINT_LOAD
public final String PROP_PROGRESS_PERIOD
public final String PROP_PRINT_POSITION
public final String PROP_PRINT_STATUS
public long progressPeriodMilliseconds
Value is read from system property slf4jtoys.meter.progress.period, defaulting to 2000 (2 seconds).
The value can be suffixed with ms, s, m, or h.
You may assign a new value at runtime.
public boolean printCategory
Value is read from system property slf4jtoys.meter.print.category, defaulting to false.
You may assign a new value at runtime.
public boolean printStatus
Value is read from system property slf4jtoys.meter.print.status, defaulting to true.
You may assign a new value at runtime.
public boolean printPosition
Value is read from system property slf4jtoys.meter.print.position, defaulting to false.
You may assign a new value at runtime.
public boolean printLoad
Value is read from system property slf4jtoys.meter.print.load, defaulting to false.
You may assign a new value at runtime.
public boolean printMemory
Value is read from system property slf4jtoys.meter.print.memory, defaulting to false.
You may assign a new value at runtime.
public String dataPrefix
By default, encoded and human-readable messages are written to the same logger. Setting a prefix allows directing encoded data to a different logger.
Example: with prefix data., a logger a.b.c.MyClass becomes data.a.b.c.MyClass for encoded
data.
Value is read from system property slf4jtoys.meter.data.prefix, defaulting to an empty string.
public String dataSuffix
By default, encoded and human-readable messages are written to the same logger. Setting a suffix allows directing encoded data to a different logger.
Example: with suffix .data, a logger a.b.c.MyClass becomes a.b.c.MyClass.data for encoded
data.
Value is read from system property slf4jtoys.meter.data.suffix, defaulting to an empty string.
public String messagePrefix
By default, encoded and human-readable messages are written to the same logger. Setting a prefix allows directing readable messages to a different logger.
Example: with prefix message., a logger a.b.c.MyClass becomes message.a.b.c.MyClass for
readable messages.
Value is read from system property slf4jtoys.meter.message.prefix, defaulting to an empty string.
public String messageSuffix
By default, encoded and human-readable messages are written to the same logger. Setting a suffix allows directing readable messages to a different logger.
Example: with suffix .message, a logger a.b.c.MyClass becomes a.b.c.MyClass.message for
readable messages.
Value is read from system property slf4jtoys.meter.message.suffix, defaulting to an empty string.
Copyright © 2010–2025. All rights reserved.