Class DataflowWorkerLoggingOptions.WorkerLogLevelOverrides
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,DataflowWorkerLoggingOptions.Level>
- Enclosing interface:
DataflowWorkerLoggingOptions
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:
- for
Fooby specifying the name"a.b.c.Foo"or theClassrepresentinga.b.c.Foo. - for
Foo,Xyz, andBarby specifying the name"a.b"or thePackagerepresentinga.b. - for
FooandBarby 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.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddOverrideForClass(Class<?> klass, DataflowWorkerLoggingOptions.Level level) Overrides the default log level for the passed in class.addOverrideForName(String name, DataflowWorkerLoggingOptions.Level level) Overrides the default log level for the passed in name.Overrides the default log level for the passed in package.Expects a map keyed by loggerNames with values representingLevels.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Constructor Details
-
WorkerLogLevelOverrides
public WorkerLogLevelOverrides()
-
-
Method Details
-
addOverrideForClass
public DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForClass(Class<?> klass, DataflowWorkerLoggingOptions.Level level) Overrides the default log level for the passed in class.This is equivalent to calling
addOverrideForName(String, DataflowWorkerLoggingOptions.Level)and passing in theclass name. -
addOverrideForPackage
public DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForPackage(Package pkg, DataflowWorkerLoggingOptions.Level level) Overrides the default log level for the passed in package.This is equivalent to calling
addOverrideForName(String, DataflowWorkerLoggingOptions.Level)and passing in thepackage name. -
addOverrideForName
public DataflowWorkerLoggingOptions.WorkerLogLevelOverrides addOverrideForName(String name, DataflowWorkerLoggingOptions.Level level) Overrides the default log level for the passed in name.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.
-
from
Expects a map keyed by loggerNames with values representingLevels. TheNamegenerally represents the fully qualified Javaclass name, or fully qualified Javapackage name, or custom logger name. TheLevelrepresents the log level and must be one ofDataflowWorkerLoggingOptions.Level.
-