Logging

org.apache.pekko.event.Logging
object Logging

Main entry point for Pekko logging: log levels and message types (aka channels) defined for the main transport medium, the main event bus. The recommended use is to obtain an implementation of the Logging trait with suitable and efficient methods for generating log events:


val log = Logging(<bus>, <source object>)
...
log.info("hello world!")

The source object is used in two fashions: its Class[_] will be part of all log events produced by this logger, plus a string representation is generated which may contain per-instance information, see apply or create below.

Loggers are attached to the level-specific channels Error, Warning, Info and Debug as appropriate for the configured (or set) log level. If you want to implement your own, make sure to handle these four event types plus the InitializeLogger message which is sent before actually attaching it to the logging bus.

Logging is configured by setting (some of) the following:


pekko {
 loggers = ["org.apache.pekko.slf4j.Slf4jLogger"] # for example
 loglevel = "INFO"        # used when normal logging ("loggers") has been started
 stdout-loglevel = "WARN" # used during application start-up until normal logging is available
}

Attributes

Source
Logging.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Logging.type

Members list

Type members

Classlikes

case class Debug(logSource: String, logClass: Class[_], message: Any = ...) extends LogEvent

For DEBUG Logging

For DEBUG Logging

Attributes

Companion
object
Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Debug2
class Debug3
object Debug

Attributes

Companion
class
Source
Logging.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Debug.type
class Debug2(logSource: String, logClass: Class[_], message: Any, val mdc: MDC) extends Debug

Attributes

Source
Logging.scala
Supertypes
class Debug
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Debug3
class Debug3(logSource: String, logClass: Class[_], message: Any, val mdc: MDC, val marker: LogMarker) extends Debug2, LogEventWithMarker

Attributes

Source
Logging.scala
Supertypes
class Debug2
class Debug
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all

Actor wrapper around the standard output logger. If pekko.loggers is not set, it defaults to just this logger.

Actor wrapper around the standard output logger. If pekko.loggers is not set, it defaults to just this logger.

Attributes

Source
Logging.scala
Supertypes
trait StdOutLogger
trait Actor
class Object
trait Matchable
class Any
Show all
case class Error(cause: Throwable, logSource: String, logClass: Class[_], message: Any = ...) extends LogEvent, LogEventWithCause

For ERROR Logging

For ERROR Logging

Attributes

Companion
object
Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Error2
class Error3
object Error

Attributes

Companion
class
Source
Logging.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Error.type
class Error2(val cause: Throwable, logSource: String, logClass: Class[_], message: Any = ..., val mdc: MDC) extends Error

Attributes

Source
Logging.scala
Supertypes
class Error
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Error3
class Error3(val cause: Throwable, logSource: String, logClass: Class[_], message: Any, val mdc: MDC, val marker: LogMarker) extends Error2, LogEventWithMarker

Attributes

Source
Logging.scala
Supertypes
class Error2
class Error
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
case class Info(logSource: String, logClass: Class[_], message: Any = ...) extends LogEvent

For INFO Logging

For INFO Logging

Attributes

Companion
object
Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Info2
class Info3
object Info

Attributes

Companion
class
Source
Logging.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Info.type
class Info2(logSource: String, logClass: Class[_], message: Any, val mdc: MDC) extends Info

Attributes

Source
Logging.scala
Supertypes
class Info
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Info3
class Info3(logSource: String, logClass: Class[_], message: Any, val mdc: MDC, val marker: LogMarker) extends Info2, LogEventWithMarker

Attributes

Source
Logging.scala
Supertypes
class Info2
class Info
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all

Message which is sent to each default logger (i.e. from configuration file) after its creation but before attaching it to the logging bus. The logger actor must handle this message, it can be used e.g. to register for more channels. When done, the logger must respond with a LoggerInitialized message. This is necessary to ensure that additional subscriptions are in effect when the logging system finished starting.

Message which is sent to each default logger (i.e. from configuration file) after its creation but before attaching it to the logging bus. The logger actor must handle this message, it can be used e.g. to register for more channels. When done, the logger must respond with a LoggerInitialized message. This is necessary to ensure that additional subscriptions are in effect when the logging system finished starting.

Attributes

Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LogEvent

Attributes

Companion
trait
Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Self type
LogEvent.type

Base type of LogEvents

Base type of LogEvents

Attributes

Companion
object
Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Debug
class Debug2
class Debug3
class Error
class Error2
class Error3
class Info
class Info2
class Info3
class Warning3
class Warning4
class Warning
class Warning2
Show all
class LogEventException(val event: LogEvent, cause: Throwable) extends NoStackTrace

Exception that wraps a LogEvent.

Exception that wraps a LogEvent.

Attributes

Source
Logging.scala
Supertypes
trait NoStackTrace
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Error
class Error2
class Error3
class Warning4
sealed trait LogEventWithMarker extends LogEvent

INTERNAL API, Marker interface for LogEvents containing Markers, which can be set for example on an slf4j logger

INTERNAL API, Marker interface for LogEvents containing Markers, which can be set for example on an slf4j logger

Attributes

Source
Logging.scala
Supertypes
trait LogEvent
class Object
trait Matchable
class Any
Known subtypes
class Debug3
class Error3
class Info3
class Warning3
class Warning4
final case class LogLevel(asInt: Int) extends AnyVal

Marker trait for annotating LogLevel, which must be Int after erasure.

Marker trait for annotating LogLevel, which must be Int after erasure.

Attributes

Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
Show all

Artificial exception injected into Error events if no Throwable is supplied; used for getting a stack dump of error locations.

Artificial exception injected into Error events if no Throwable is supplied; used for getting a stack dump of error locations.

Attributes

Source
Logging.scala
Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

LoggerInitializationException is thrown to indicate that there was a problem initializing a logger

LoggerInitializationException is thrown to indicate that there was a problem initializing a logger

Attributes

Source
Logging.scala
Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
abstract class LoggerInitialized

Response message each logger must send within 1 second after receiving the InitializeLogger request. If initialization takes longer, send the reply as soon as subscriptions are set-up.

Response message each logger must send within 1 second after receiving the InitializeLogger request. If initialization takes longer, send the reply as soon as subscriptions are set-up.

Attributes

Companion
object
Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case object LoggerInitialized extends LoggerInitialized

Attributes

Companion
class
Source
Logging.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Actor-less logging implementation for synchronous logging to standard output. This logger is always attached first in order to be able to log failures during application start-up, even before normal logging is started. Its log level can be defined by configuration setting pekko.stdout-loglevel.

Actor-less logging implementation for synchronous logging to standard output. This logger is always attached first in order to be able to log failures during application start-up, even before normal logging is started. Its log level can be defined by configuration setting pekko.stdout-loglevel.

Attributes

Source
Logging.scala
Supertypes
trait StdOutLogger
class ActorRef
trait Serializable
trait Comparable[ActorRef]
class Object
trait Matchable
class Any
Show all
object StdOutLogger

Attributes

Companion
trait
Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait StdOutLogger

Attributes

Companion
object
Source
Logging.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class Warning(logSource: String, logClass: Class[_], message: Any = ...) extends LogEvent

For WARNING Logging

For WARNING Logging

Attributes

Companion
object
Source
Logging.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Warning2
class Warning3
class Warning4
object Warning

Attributes

Companion
class
Source
Logging.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Warning.type
class Warning2(logSource: String, logClass: Class[_], message: Any, val mdc: MDC) extends Warning

Attributes

Source
Logging.scala
Supertypes
class Warning
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
Known subtypes
class Warning3
class Warning4
class Warning3(logSource: String, logClass: Class[_], message: Any, val mdc: MDC, val marker: LogMarker) extends Warning2, LogEventWithMarker

Attributes

Source
Logging.scala
Supertypes
class Warning2
class Warning
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all
class Warning4(logSource: String, logClass: Class[_], message: Any, val mdc: MDC, val marker: LogMarker, val cause: Throwable) extends Warning2, LogEventWithMarker, LogEventWithCause

Attributes

Source
Logging.scala
Supertypes
class Warning2
class Warning
trait Serializable
trait Product
trait Equals
trait LogEvent
class Object
trait Matchable
class Any
Show all

Types

type MDC = Map[String, Any]

Attributes

Source
Logging.scala

Value members

Concrete methods

def apply[T : LogSource](system: ActorSystem, logSource: T): LoggingAdapter

Obtain LoggingAdapter for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Obtain LoggingAdapter for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Do not use this if you want to supply a log category string (like “com.example.app.whatever”) unaltered, supply system.eventStream in this case or use

Logging(system, this.getClass)

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

You can add your own rules quite easily, see pekko.event.LogSource.

Attributes

Source
Logging.scala
def apply[T : LogSource](bus: LoggingBus, logSource: T): LoggingAdapter

Obtain LoggingAdapter for the given logging bus and source object.

Obtain LoggingAdapter for the given logging bus and source object.

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

You can add your own rules quite easily, see pekko.event.LogSource.

Note that this LoggingAdapter will use the pekko.event.DefaultLoggingFilter, and not the pekko.event.LoggingFilter configured for the system (if different from DefaultLoggingFilter).

Attributes

Source
Logging.scala

Obtain LoggingAdapter with MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Obtain LoggingAdapter with MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Attributes

Source
Logging.scala
def classFor(level: LogLevel): Class[_ <: LogEvent]

Returns the event class associated with the given LogLevel

Returns the event class associated with the given LogLevel

Attributes

Source
Logging.scala
def getLogger(system: ActorSystem, logSource: AnyRef): LoggingAdapter

Obtain LoggingAdapter for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Obtain LoggingAdapter for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Do not use this if you want to supply a log category string (like “com.example.app.whatever”) unaltered, supply system.eventStream in this case or use

Logging.getLogger(system, this.getClass());

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

Attributes

Source
Logging.scala
def getLogger(bus: LoggingBus, logSource: AnyRef): LoggingAdapter

Obtain LoggingAdapter for the given logging bus and source object.

Obtain LoggingAdapter for the given logging bus and source object.

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

Note that this LoggingAdapter will use the pekko.event.DefaultLoggingFilter, and not the pekko.event.LoggingFilter configured for the system (if different from DefaultLoggingFilter).

Attributes

Source
Logging.scala

Obtain LoggingAdapter with MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Obtain LoggingAdapter with MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Attributes

Source
Logging.scala

Returns the LogLevel associated with the given string, valid inputs are upper or lowercase (not mixed) versions of: "error", "warning", "info" and "debug"

Returns the LogLevel associated with the given string, valid inputs are upper or lowercase (not mixed) versions of: "error", "warning", "info" and "debug"

Attributes

Source
Logging.scala
def levelFor(eventClass: Class[_ <: LogEvent]): LogLevel

Returns the LogLevel associated with the given event class. Defaults to DebugLevel.

Returns the LogLevel associated with the given event class. Defaults to DebugLevel.

Attributes

Source
Logging.scala

Java API to create a LoggerInitialized message.

Java API to create a LoggerInitialized message.

Attributes

Source
Logging.scala
def messageClassName(message: Any): String

Class name representation of a message. ActorSelectionMessage representation includes class name of wrapped message.

Class name representation of a message. ActorSelectionMessage representation includes class name of wrapped message.

Attributes

Source
Logging.scala
def noCause: NoCause.type

Attributes

Source
Logging.scala
def simpleName(obj: AnyRef): String

Returns a 'safe' getSimpleName for the provided object's Class

Returns a 'safe' getSimpleName for the provided object's Class

Attributes

Returns

the simple name of the given object's Class

Source
Logging.scala
def simpleName(clazz: Class[_]): String

Returns a 'safe' getSimpleName for the provided Class

Returns a 'safe' getSimpleName for the provided Class

Attributes

Returns

the simple name of the given Class

Source
Logging.scala

Returns the StackTrace for the given Throwable as a String

Returns the StackTrace for the given Throwable as a String

Attributes

Source
Logging.scala
def withMarker[T : LogSource](system: ActorSystem, logSource: T): MarkerLoggingAdapter

Obtain LoggingAdapter with additional "marker" support (which some logging frameworks are able to utilise) for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Obtain LoggingAdapter with additional "marker" support (which some logging frameworks are able to utilise) for the given actor system and source object. This will use the system’s event stream and include the system’s address in the log source string.

Do not use this if you want to supply a log category string (like “com.example.app.whatever”) unaltered, supply system.eventStream in this case or use

Logging(system, this.getClass)

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

You can add your own rules quite easily, see pekko.event.LogSource.

Attributes

Source
Logging.scala
def withMarker[T : LogSource](bus: LoggingBus, logSource: T): MarkerLoggingAdapter

Obtain LoggingAdapter for the given logging bus and source object.

Obtain LoggingAdapter for the given logging bus and source object.

The source is used to identify the source of this logging channel and must have a corresponding implicit LogSource[T] instance in scope; by default these are provided for Class[_], Actor, ActorRef and String types. See the companion object of pekko.event.LogSource for details.

You can add your own rules quite easily, see pekko.event.LogSource.

Note that this LoggingAdapter will use the pekko.event.DefaultLoggingFilter, and not the pekko.event.LoggingFilter configured for the system (if different from DefaultLoggingFilter).

Attributes

Source
Logging.scala

Obtain LoggingAdapter with marker and MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Obtain LoggingAdapter with marker and MDC support for the given actor. Don't use it outside its specific Actor as it isn't thread safe

Attributes

Source
Logging.scala

Concrete fields

Attributes

Source
Logging.scala
final val DebugLevel: LogLevel

Attributes

Source
Logging.scala
final val ErrorLevel: LogLevel

Log level in numeric form, used when deciding whether a certain log statement should generate a log event. Predefined levels are ErrorLevel (1) to DebugLevel (4). In case you want to add more levels, loggers need to be subscribed to their event bus channels manually.

Log level in numeric form, used when deciding whether a certain log statement should generate a log event. Predefined levels are ErrorLevel (1) to DebugLevel (4). In case you want to add more levels, loggers need to be subscribed to their event bus channels manually.

Attributes

Source
Logging.scala
final val InfoLevel: LogLevel

Attributes

Source
Logging.scala
final val WarningLevel: LogLevel

Attributes

Source
Logging.scala
val emptyMDC: MDC

Attributes

Source
Logging.scala