public static class SdkHarnessOptions.SdkHarnessLogLevelOverrides extends java.util.HashMap<java.lang.String,SdkHarnessOptions.LogLevel>
The SDK harness supports a logging hierarchy based off of names that are "." separated. It
is a common pattern to have the logger for a given class share the same name as the class
itself. Given the classes a.b.c.Foo
, a.b.c.Xyz
, and a.b.Bar
, with
loggers named "a.b.c.Foo"
, "a.b.c.Xyz"
, and "a.b.Bar"
respectively, we
can override the log levels:
Foo
by specifying the name "a.b.c.Foo"
or the Class
representing a.b.c.Foo
.
Foo
, Xyz
, and Bar
by specifying the name "a.b"
or the
Package
representing a.b
.
Foo
and Bar
by specifying both of their names or classes.
System.out
and System.err
messages are configured via loggers of the
corresponding name. Note that by specifying multiple overrides, the exact name followed by the
closest parent takes precedence.
Constructor and Description |
---|
SdkHarnessLogLevelOverrides() |
Modifier and Type | Method and Description |
---|---|
SdkHarnessOptions.SdkHarnessLogLevelOverrides |
addOverrideForClass(java.lang.Class<?> klass,
SdkHarnessOptions.LogLevel logLevel)
Overrides the default log level for the passed in class.
|
SdkHarnessOptions.SdkHarnessLogLevelOverrides |
addOverrideForName(java.lang.String name,
SdkHarnessOptions.LogLevel logLevel)
Overrides the default log logLevel for the passed in name.
|
SdkHarnessOptions.SdkHarnessLogLevelOverrides |
addOverrideForPackage(java.lang.Package pkg,
SdkHarnessOptions.LogLevel logLevel)
Overrides the default log level for the passed in package.
|
static SdkHarnessOptions.SdkHarnessLogLevelOverrides |
from(java.util.Map<java.lang.String,java.lang.String> values)
Expects a map keyed by logger
Name s with values representing LogLevel s. |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForClass(java.lang.Class<?> klass, SdkHarnessOptions.LogLevel logLevel)
This is equivalent to calling #addOverrideForName(String, LogLevel)
and passing in
the class name
.
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForPackage(java.lang.Package pkg, SdkHarnessOptions.LogLevel logLevel)
This is equivalent to calling #addOverrideForName(String, LogLevel)
and passing in
the package name
.
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForName(java.lang.String name, SdkHarnessOptions.LogLevel logLevel)
Note that because of the hierarchical nature of logger names, this will override the log logLevel of all loggers that have the passed in name or a parent logger that has the passed in name.
public static SdkHarnessOptions.SdkHarnessLogLevelOverrides from(java.util.Map<java.lang.String,java.lang.String> values)
Name
s with values representing LogLevel
s. The
Name
generally represents the fully qualified Java class
name
, or fully qualified Java package name
, or custom logger name.
The LogLevel
represents the log level and must be one of SdkHarnessOptions.LogLevel
.