Class RestartSettings.LogSettings
- java.lang.Object
-
- akka.stream.RestartSettings.LogSettings
-
- Enclosing class:
- RestartSettings
public static final class RestartSettings.LogSettings extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LogSettings(Logging.LogLevel logLevel, Logging.LogLevel criticalLogLevel, int criticalLogLevelAfter)LogSettings(Logging.LogLevel logLevel, Logging.LogLevel criticalLogLevel, int criticalLogLevelAfter, scala.Option<java.lang.Object> verboseLogsAfter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Logging.LogLevelcriticalLogLevel()intcriticalLogLevelAfter()Logging.LogLevellogLevel()scala.Option<java.lang.Object>verboseLogsAfter()RestartSettings.LogSettingswithCriticalLogLevel(Logging.LogLevel criticalLevel, int afterErrors)Possibility to use another log level after a given number of errors.RestartSettings.LogSettingswithFailureLogging(java.util.function.Consumer<RestartSettings.RestartFailure> logFailure)Replace the logging of failures that restart the stream with a custom callback, for example to log some failures to a different logger or at a different level.RestartSettings.LogSettingswithLogLevel(Logging.LogLevel level)RestartSettings.LogSettingswithVerboseLogsAfter(int afterErrors)If set, warning and error logs will use only the exception message up toafterErrorsconsecutive errors, after reaching the number of consecutive errors, the entire exception with stacktrace is logged.
-
-
-
Constructor Detail
-
LogSettings
public LogSettings(Logging.LogLevel logLevel, Logging.LogLevel criticalLogLevel, int criticalLogLevelAfter, scala.Option<java.lang.Object> verboseLogsAfter)
-
LogSettings
public LogSettings(Logging.LogLevel logLevel, Logging.LogLevel criticalLogLevel, int criticalLogLevelAfter)
-
-
Method Detail
-
logLevel
public Logging.LogLevel logLevel()
-
criticalLogLevel
public Logging.LogLevel criticalLogLevel()
-
criticalLogLevelAfter
public int criticalLogLevelAfter()
-
verboseLogsAfter
public scala.Option<java.lang.Object> verboseLogsAfter()
-
withLogLevel
public RestartSettings.LogSettings withLogLevel(Logging.LogLevel level)
-
withCriticalLogLevel
public RestartSettings.LogSettings withCriticalLogLevel(Logging.LogLevel criticalLevel, int afterErrors)
Possibility to use another log level after a given number of errors. The initial errors are logged at the level defined withLogSettings.withLogLevel. For example, the first 3 errors can be logged at INFO level and thereafter at ERROR level.The counter (and log level) is reset after the
RestartSettings.maxRestartsWithinduration.
-
withVerboseLogsAfter
public RestartSettings.LogSettings withVerboseLogsAfter(int afterErrors)
If set, warning and error logs will use only the exception message up toafterErrorsconsecutive errors, after reaching the number of consecutive errors, the entire exception with stacktrace is logged.The counter (and verbosity level) is reset after the
RestartSettings.maxRestartsWithinduration.
-
withFailureLogging
public RestartSettings.LogSettings withFailureLogging(java.util.function.Consumer<RestartSettings.RestartFailure> logFailure)
Replace the logging of failures that restart the stream with a custom callback, for example to log some failures to a different logger or at a different level.The callback is called for each failure that restarts the stream, also when logging is disabled for the stream, and then is the only logging of the failure. This includes a wrapped sink or flow that cancels its upstream with a failure. The default logging does not log such failures, so for them
RestartFailure.defaultLogLevelis off,RestartFailure.defaultVerboseis false andRestartFailure.logDefaultdoes nothing. For other failures,defaultLogLeveltells what the default logging would have done, andlogDefaultdoes it.The callback runs inside the stream operator, on the thread of the stream's dispatcher. It must be lightweight and must not block. If one settings instance is used by several running streams, the callback can be called concurrently. If it throws, the stream fails with that exception, and the failure that caused the restart is added to it as suppressed.
Restarts because of stream completion are not passed to the callback. The callback must not be
null.
-
-