@ThreadSafe
public final class Traces
extends Object
Adds entries to a traces file. Each entry tells the time the entry was added, then the description of a value. Each service using traces has a dedicated directory. Within that directory, individual directories are used to segregate entries by category, traces for each category. Within these directories, a new traces file is created each day.
| Modifier and Type | Class and Description |
|---|---|
static class |
Traces.Context
Context.
|
static interface |
Traces.Listener
Tracer listener.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPRESSED_PROPERTY
Requests that the service traces be compressed.
|
static String |
COMPRESSED_SUFFIX_PROPERTY
The file name suffix for compressed traces files.
|
static String |
DEFAULT_COMPRESSED_SUFFIX
Default compressed file suffix.
|
static String |
DEFAULT_PREFIX
Default traces prefix.
|
static String |
DEFAULT_ROOT
Default traces root directory.
|
static String |
DEFAULT_SUFFIX
Default traces suffix.
|
static String |
DIR_PROPERTY
The directory name for the service traces.
|
static String |
DISABLED_PROPERTY
Disables the service traces.
|
static String |
PREFIX_PROPERTY
The file name prefix for traces files.
|
static String |
ROOT_PROPERTY
The root directory for the service traces.
|
static String |
SUFFIX_PROPERTY
The file name suffix for traces files.
|
static String |
TRACES_PROPERTIES
Traces properties.
|
| Constructor and Description |
|---|
Traces()
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object value)
Adds a value to the traces.
|
void |
add(Optional<String> classifier,
Object value)
Adds a value to the traces.
|
boolean |
addListener(Traces.Listener listener)
Adds a listener for this.
|
void |
commit()
Commits the accumulated entries to file.
|
boolean |
isEnabled()
Asks if this is enabled.
|
boolean |
removeListener(Traces.Listener listener)
Removes a listener for this.
|
void |
rollback()
Forgets about the accumulated entries.
|
void |
setCompressed(boolean compressed)
Sets the compressed files indicator.
|
void |
setPrefix(String prefix)
Sets the prefix for the traces files.
|
void |
setSuffix(String suffix)
Sets the suffix for the traces files.
|
boolean |
setUp(File where,
KeyedGroups how,
UUID who,
Optional<String> what)
Sets up this.
|
void |
tearDown()
Tears down what has been set up.
|
public static final String COMPRESSED_PROPERTY
public static final String COMPRESSED_SUFFIX_PROPERTY
public static final String DEFAULT_COMPRESSED_SUFFIX
public static final String DEFAULT_PREFIX
public static final String DEFAULT_ROOT
public static final String DEFAULT_SUFFIX
public static final String DIR_PROPERTY
public static final String DISABLED_PROPERTY
public static final String PREFIX_PROPERTY
public static final String ROOT_PROPERTY
public static final String SUFFIX_PROPERTY
public static final String TRACES_PROPERTIES
public void add(@Nonnull
Object value)
value - The value.public void add(@Nonnull
Optional<String> classifier,
@Nonnull
Object value)
classifier - An optional classifier.value - The value.@CheckReturnValue
public boolean addListener(@Nonnull
Traces.Listener listener)
listener - The listener.public void commit()
@CheckReturnValue public boolean isEnabled()
@CheckReturnValue
public boolean removeListener(@Nonnull
Traces.Listener listener)
listener - The listener.public void rollback()
public void setCompressed(boolean compressed)
compressed - The compressed files indicator.public void setPrefix(@Nonnull
String prefix)
prefix - The prefix.public void setSuffix(@Nonnull
String suffix)
suffix - The suffix.@CheckReturnValue
public boolean setUp(@Nonnull
File where,
@Nonnull
KeyedGroups how,
@Nonnull
UUID who,
@Nonnull
Optional<String> what)
where - The destination's parent directory (data directory).how - The traces properties.who - Who is tracing (used as default directory name).what - What will be traced (subdirectory).public void tearDown()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.