public static class DataflowWorkerLoggingOptions.WorkerLogLevelOverrides extends java.util.HashMap<java.lang.String,DataflowWorkerLoggingOptions.Level>
The Dataflow worker 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 |
---|
WorkerLogLevelOverrides() |
Modifier and Type | Method and Description |
---|---|
DataflowWorkerLoggingOptions.WorkerLogLevelOverrides |
addOverrideForClass(java.lang.Class<?> klass,
DataflowWorkerLoggingOptions.Level level)
Overrides the default log level for the passed in class.
|
DataflowWorkerLoggingOptions.WorkerLogLevelOverrides |
addOverrideForName(java.lang.String name,
DataflowWorkerLoggingOptions.Level level)
Overrides the default log level for the passed in name.
|
DataflowWorkerLoggingOptions.WorkerLogLevelOverrides |
addOverrideForPackage(java.lang.Package pkg,
DataflowWorkerLoggingOptions.Level level)
Overrides the default log level for the passed in package.
|
static DataflowWorkerLoggingOptions.WorkerLogLevelOverrides |
from(java.util.Map<java.lang.String,java.lang.String> values)
Expects a map keyed by logger
Name s with values representing Level 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 DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForClass(java.lang.Class<?> klass, DataflowWorkerLoggingOptions.Level level)
This is equivalent to calling addOverrideForName(String,
DataflowWorkerLoggingOptions.Level)
and passing in the class name
.
public DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForPackage(java.lang.Package pkg, DataflowWorkerLoggingOptions.Level level)
This is equivalent to calling addOverrideForName(String,
DataflowWorkerLoggingOptions.Level)
and passing in the package
name
.
public DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForName(java.lang.String name, DataflowWorkerLoggingOptions.Level level)
Note that because of the hierarchical nature of logger names, this will override the log level of all loggers that have the passed in name or a parent logger that has the passed in name.
public static DataflowWorkerLoggingOptions.WorkerLogLevelOverrides from(java.util.Map<java.lang.String,java.lang.String> values)
Name
s with values representing Level
s. The
Name
generally represents the fully qualified Java class
name
, or fully qualified Java package name
, or custom logger name.
The Level
represents the log level and must be one of DataflowWorkerLoggingOptions.Level
.