Object

akka.event

Logging

Related Doc: package event

Permalink

object Logging

Main entry point for Akka 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:


akka {
  loggers = ["akka.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
}

Source
Logging.scala
Linear Supertypes
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Logging
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

    For DEBUG Logging

  2. class Debug2 extends Debug

    Permalink
  3. class Debug3 extends Debug2 with LogEventWithMarker

    Permalink
  4. class DefaultLogger extends Actor with StdOutLogger with RequiresMessageQueue[LoggerMessageQueueSemantics]

    Permalink

    Actor wrapper around the standard output logger.

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

  5. case class Error(cause: Throwable, logSource: String, logClass: Class[_], message: Any = "") extends LogEvent with Product with Serializable

    Permalink

    For ERROR Logging

  6. class Error2 extends Error

    Permalink
  7. class Error3 extends Error2 with LogEventWithMarker

    Permalink
  8. case class Info(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent with Product with Serializable

    Permalink

    For INFO Logging

  9. class Info2 extends Info

    Permalink
  10. class Info3 extends Info2 with LogEventWithMarker

    Permalink
  11. final case class InitializeLogger(bus: LoggingBus) extends NoSerializationVerificationNeeded with Product with Serializable

    Permalink

    Message which is sent to each default logger (i.e.

    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.

  12. sealed trait LogEvent extends NoSerializationVerificationNeeded

    Permalink

    Base type of LogEvents

  13. class LogEventException extends Throwable with NoStackTrace

    Permalink

    Exception that wraps a LogEvent.

  14. sealed trait LogEventWithMarker extends LogEvent

    Permalink

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

  15. final case class LogLevel(asInt: Int) extends AnyVal with Product with Serializable

    Permalink

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

  16. class LoggerException extends AkkaException

    Permalink

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

  17. class LoggerInitializationException extends AkkaException

    Permalink

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

  18. abstract class LoggerInitialized extends AnyRef

    Permalink

    Response message each logger must send within 1 second after receiving the InitializeLogger request.

    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.

  19. type MDC = Map[String, Any]

    Permalink
  20. class StandardOutLogger extends InternalActorRef with MinimalActorRef with StdOutLogger

    Permalink

    Actor-less logging implementation for synchronous logging to standard output.

    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 akka.stdout-loglevel.

  21. trait StdOutLogger extends AnyRef

    Permalink
  22. case class Warning(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent with Product with Serializable

    Permalink

    For WARNING Logging

  23. class Warning2 extends Warning

    Permalink
  24. class Warning3 extends Warning2 with LogEventWithMarker

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val AllLogLevels: Seq[LogLevel]

    Permalink
  5. object Debug extends Serializable

    Permalink
  6. final val DebugLevel: LogLevel

    Permalink
  7. object Error extends Serializable

    Permalink
  8. final val ErrorLevel: LogLevel

    Permalink

    Log level in numeric form, used when deciding whether a certain log statement should generate a log event.

    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.

  9. object Info extends Serializable

    Permalink
  10. final val InfoLevel: LogLevel

    Permalink
  11. object LogEvent

    Permalink
  12. object LoggerInitialized extends LoggerInitialized with Product with Serializable

    Permalink
  13. val StandardOutLogger: StandardOutLogger

    Permalink
  14. object StdOutLogger

    Permalink
  15. object Warning extends Serializable

    Permalink
  16. final val WarningLevel: LogLevel

    Permalink
  17. def apply(logSource: Actor): DiagnosticLoggingAdapter

    Permalink

    Obtain LoggingAdapter with MDC support for the given actor.

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

  18. def apply[T](bus: LoggingBus, logSource: T)(implicit arg0: LogSource[T]): LoggingAdapter

    Permalink

    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 akka.event.LogSource for details.

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

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

  19. def apply[T](system: ActorSystem, logSource: T)(implicit arg0: LogSource[T]): LoggingAdapter

    Permalink

    Obtain LoggingAdapter for the given actor system and source object.

    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 akka.event.LogSource for details.

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

  20. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  21. def classFor(level: LogLevel): Class[_ <: LogEvent]

    Permalink

    Returns the event class associated with the given LogLevel

  22. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  23. val emptyMDC: MDC

    Permalink
  24. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  27. def getLogger(logSource: Actor): DiagnosticLoggingAdapter

    Permalink

    Obtain LoggingAdapter with MDC support for the given actor.

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

  28. def getLogger(bus: LoggingBus, logSource: AnyRef): LoggingAdapter

    Permalink

    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 akka.event.LogSource for details.

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

  29. def getLogger(system: ActorSystem, logSource: AnyRef): LoggingAdapter

    Permalink

    Obtain LoggingAdapter for the given actor system and source object.

    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 akka.event.LogSource for details.

  30. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. def levelFor(eventClass: Class[_ <: LogEvent]): LogLevel

    Permalink

    Returns the LogLevel associated with the given event class.

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

  33. def levelFor(s: String): Option[LogLevel]

    Permalink

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

  34. def loggerInitialized(): LoggerInitialized.type

    Permalink

    Java API to create a LoggerInitialized message.

  35. def messageClassName(message: Any): String

    Permalink

    Class name representation of a message.

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

  36. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  37. def noCause: NoCause.type

    Permalink
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  40. def simpleName(clazz: Class[_]): String

    Permalink

    Returns a 'safe' getSimpleName for the provided Class

    Returns a 'safe' getSimpleName for the provided Class

    returns

    the simple name of the given Class

  41. def simpleName(obj: AnyRef): String

    Permalink

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

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

    returns

    the simple name of the given object's Class

  42. def stackTraceFor(e: Throwable): String

    Permalink

    Returns the StackTrace for the given Throwable as a String

  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  45. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. def withMarker(logSource: Actor): DiagnosticMarkerBusLoggingAdapter

    Permalink

    Obtain LoggingAdapter with marker and MDC support for the given actor.

    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

  49. def withMarker[T](bus: LoggingBus, logSource: T)(implicit arg0: LogSource[T]): MarkerLoggingAdapter

    Permalink

    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 akka.event.LogSource for details.

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

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

  50. def withMarker[T](system: ActorSystem, logSource: T)(implicit arg0: LogSource[T]): MarkerLoggingAdapter

    Permalink

    Obtain LoggingAdapter with additional "marker" support (which some logging frameworks are able to utilise) for the given actor system and source object.

    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 akka.event.LogSource for details.

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

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  2. def getLogger(logSource: UntypedActor): DiagnosticLoggingAdapter

    Permalink

    Obtain LoggingAdapter with MDC support for the given actor.

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

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.0) Use AbstractActor instead of UntypedActor.

Inherited from AnyRef

Inherited from Any

Ungrouped