Class SdkHarnessOptions.SdkHarnessLogLevelOverrides
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,SdkHarnessOptions.LogLevel>
-
- org.apache.beam.sdk.options.SdkHarnessOptions.SdkHarnessLogLevelOverrides
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,SdkHarnessOptions.LogLevel>
- Enclosing interface:
- SdkHarnessOptions
public static class SdkHarnessOptions.SdkHarnessLogLevelOverrides extends java.util.HashMap<java.lang.String,SdkHarnessOptions.LogLevel>
Defines a log level override for a specific class, package, or name.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
, anda.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
Foo
by specifying the name"a.b.c.Foo"
or theClass
representinga.b.c.Foo
. - for
Foo
,Xyz
, andBar
by specifying the name"a.b"
or thePackage
representinga.b
. - for
Foo
andBar
by specifying both of their names or classes.
System.out
andSystem.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SdkHarnessLogLevelOverrides()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 loggerName
s with values representingLogLevel
s.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
addOverrideForClass
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForClass(java.lang.Class<?> klass, SdkHarnessOptions.LogLevel logLevel)
Overrides the default log level for the passed in class.This is equivalent to calling
addOverrideForName(String, LogLevel)
and passing in theclass name
.
-
addOverrideForPackage
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForPackage(java.lang.Package pkg, SdkHarnessOptions.LogLevel logLevel)
Overrides the default log level for the passed in package.This is equivalent to calling
addOverrideForName(String, LogLevel)
and passing in thepackage name
.
-
addOverrideForName
public SdkHarnessOptions.SdkHarnessLogLevelOverrides addOverrideForName(java.lang.String name, SdkHarnessOptions.LogLevel logLevel)
Overrides the default log logLevel for the passed in name.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.
-
from
public static SdkHarnessOptions.SdkHarnessLogLevelOverrides from(java.util.Map<java.lang.String,java.lang.String> values)
Expects a map keyed by loggerName
s with values representingLogLevel
s. TheName
generally represents the fully qualified Javaclass name
, or fully qualified Javapackage name
, or custom logger name. TheLogLevel
represents the log level and must be one ofSdkHarnessOptions.LogLevel
.
-
-