package event
- Alphabetic
- Public
- All
Type Members
-
class
ActorClassificationUnsubscriber
extends Actor with Stash
INTERNAL API
INTERNAL API
Watches all actors which subscribe on the given event stream, and unsubscribes them from it when they are Terminated.
- Attributes
- protected[akka]
-
trait
ActorClassifier
extends AnyRef
Can be mixed into an EventBus to specify that the Classifier type is ActorRef
-
trait
ActorEventBus
extends EventBus
Represents an EventBus where the Subscriber type is ActorRef
-
class
BusLogging
extends LoggingAdapter
akka.event.LoggingAdapter that publishes akka.event.Logging.LogEvent to event stream.
- class DeadLetterListener extends Actor
-
class
DefaultLoggingFilter
extends LoggingFilter
Default LoggingFilter that uses the logLevel of the
eventStream
, which initial value is defined in configuration.Default LoggingFilter that uses the logLevel of the
eventStream
, which initial value is defined in configuration. The logLeveleventStream
can be changed while the system is running. -
trait
DiagnosticLoggingAdapter
extends LoggingAdapter
LoggingAdapter extension which adds MDC support.
LoggingAdapter extension which adds MDC support. Only recommended to be used within Actors as it isn't thread safe.
- final class DiagnosticMarkerBusLoggingAdapter extends MarkerLoggingAdapter with DiagnosticLoggingAdapter
-
class
DummyClassForStringSources
extends AnyRef
This is a “marker” class which is inserted as originator class into akka.event.Logging.LogEvent when the string representation was supplied directly.
-
trait
EventBus
extends AnyRef
Represents the base type for EventBuses Internally has an Event type, a Classifier type and a Subscriber type
Represents the base type for EventBuses Internally has an Event type, a Classifier type and a Subscriber type
For the Java API, see akka.event.japi.*
-
class
EventStream
extends LoggingBus with SubchannelClassification
An Akka EventStream is a pub-sub stream of events both system and user generated, where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object.
An Akka EventStream is a pub-sub stream of events both system and user generated, where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object. EventStreams employ SubchannelClassification, which means that if you listen to a Class, you'll receive any message that is of that type or a subtype.
The debug flag in the constructor toggles if operations on this EventStream should also be published as Debug-Events
-
class
EventStreamUnsubscriber
extends Actor
INTERNAL API
INTERNAL API
Watches all actors which subscribe on the given eventStream, and unsubscribes them from it when they are Terminated.
Assumptions note: We do not guarantee happens-before in the EventStream when 2 threads subscribe(a) / unsubscribe(a) on the same actor, thus the messages sent to this actor may appear to be reordered - this is fine, because the worst-case is starting to needlessly watch the actor which will not cause trouble for the stream. This is a trade-off between slowing down subscribe calls * because of the need of linearizing the history message sequence and the possibility of sometimes watching a few actors too much - we opt for the 2nd choice here.
- Attributes
- protected[akka]
- final class LogMarker extends AnyRef
-
trait
LogSource
[-T] extends AnyRef
This trait defines the interface to be provided by a “log source formatting rule” as used by akka.event.Logging’s
apply
/create
method.This trait defines the interface to be provided by a “log source formatting rule” as used by akka.event.Logging’s
apply
/create
method.See the companion object for default implementations.
Example:
trait MyType { // as an example def name: String } implicit val myLogSourceType: LogSource[MyType] = new LogSource[MyType] { def genString(a: MyType) = a.name } class MyClass extends MyType { val log = Logging(eventStream, this) // will use "hallo" as logSource def name = "hallo" }
The second variant is used for including the actor system’s address:
trait MyType { // as an example def name: String } implicit val myLogSourceType: LogSource[MyType] = new LogSource[MyType] { def genString(a: MyType) = a.name def genString(a: MyType, s: ActorSystem) = a.name + "," + s } class MyClass extends MyType { val sys = ActorSystem("sys") val log = Logging(sys, this) // will use "hallo,akka://sys" as logSource def name = "hallo" }
The default implementation of the second variant will just call the first.
- Annotations
- @implicitNotFound( ... )
- trait LoggerMessageQueueSemantics extends AnyRef
-
trait
LoggingAdapter
extends AnyRef
Logging wrapper to make nicer and optimize: provide template versions which evaluate .toString only if the log level is actually enabled.
Logging wrapper to make nicer and optimize: provide template versions which evaluate .toString only if the log level is actually enabled. Typically used by obtaining an implementation from the Logging object:
val log = Logging(<bus>, <source object>) ... log.info("hello world!")
All log-level methods support simple interpolation templates with up to four arguments placed by using
{}
within the template (first string argument):log.error(exception, "Exception while processing {} in state {}", msg, state)
-
trait
LoggingBus
extends ActorEventBus
This trait brings log level handling to the EventStream: it reads the log levels for the initial logging (StandardOutLogger) and the loggers & level for after-init logging, possibly keeping the StandardOutLogger enabled if it is part of the configured loggers.
This trait brings log level handling to the EventStream: it reads the log levels for the initial logging (StandardOutLogger) and the loggers & level for after-init logging, possibly keeping the StandardOutLogger enabled if it is part of the configured loggers. All configured loggers are treated as system services and managed by this trait, i.e. subscribed/unsubscribed in response to changes of LoggingBus.logLevel.
-
trait
LoggingFilter
extends AnyRef
Filter of log events that is used by the
LoggingAdapter
before publishing log events to theeventStream
.Filter of log events that is used by the
LoggingAdapter
before publishing log events to theeventStream
. It can perform fine grained filtering based on the log source.Note that the EventStream will only subscribe
loggers
to the events corresponding to thelogLevel
of theEventStream
. Therefore it is good practice that theLoggingFilter
implementation first filters using thelogLevel
of theEventStream
before applying more fine grained filters. -
class
LoggingReceive
extends Receive
This decorator adds invocation logging to a Receive function.
-
trait
LookupClassification
extends AnyRef
Maps Subscribers to Classifiers using equality on Classifier to store a Set of Subscribers (hence the need for compareSubscribers) Maps Events to Classifiers through the classify-method (so it knows who to publish to)
Maps Subscribers to Classifiers using equality on Classifier to store a Set of Subscribers (hence the need for compareSubscribers) Maps Events to Classifiers through the classify-method (so it knows who to publish to)
The compareSubscribers need to provide a total ordering of the Subscribers
-
trait
ManagedActorClassification
extends AnyRef
Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs.
Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs.
All subscribers will be watched by an
akka.event.ActorClassificationUnsubscriber
and unsubscribed when they terminate. The unsubscriber actor will not be stopped automatically, and if you want to stop using the bus you should stop it yourself. -
class
MarkerLoggingAdapter
extends BusLogging
LoggingAdapter extension which adds Marker support.
LoggingAdapter extension which adds Marker support. Only recommended to be used within Actors as it isn't thread safe.
-
trait
PredicateClassifier
extends AnyRef
Can be mixed into an EventBus to specify that the Classifier type is a Function from Event to Boolean (predicate)
-
trait
ScanningClassification
extends AnyRef
Maps Classifiers to Subscribers and selects which Subscriber should receive which publication through scanning through all Subscribers through the matches(classifier, event) method
Maps Classifiers to Subscribers and selects which Subscriber should receive which publication through scanning through all Subscribers through the matches(classifier, event) method
Note: the compareClassifiers and compareSubscribers must together form an absolute ordering (think java.util.Comparator.compare)
-
trait
SubchannelClassification
extends AnyRef
Classification which respects relationships between channels: subscribing to one channel automatically and idempotently subscribes to all sub-channels.
-
trait
ActorClassification
extends AnyRef
Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs
Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs
- Annotations
- @deprecated
- Deprecated
(Since version 2.4) Use Managed ActorClassification instead
Value Members
- object EventStream
- object LogMarker
-
object
LogSource
This object holds predefined formatting rules for log sources.
This object holds predefined formatting rules for log sources.
In case an akka.actor.ActorSystem is provided, the following apply:
- akka.actor.Actor and akka.actor.ActorRef will be represented by their absolute physical path
- providing a
String
as source will append "(<system address>)" and use the result - providing a
Class
will extract its simple name, append "(<system address>)" and use the result - anything else gives compile error unless implicit akka.event.LogSource is in scope for it
In case a akka.event.LoggingBus is provided, the following apply:
- akka.actor.Actor and akka.actor.ActorRef will be represented by their absolute physical path
- providing a
String
as source will be used as is - providing a
Class
will extract its simple name - anything else gives compile error unless implicit akka.event.LogSource is in scope for it
-
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.
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, seeapply
orcreate
below.Loggers are attached to the level-specific channels
Error
,Warning
,Info
andDebug
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 theInitializeLogger
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 }
- object LoggingReceive
-
object
NoLogging
extends LoggingAdapter
NoLogging is a LoggingAdapter that does absolutely nothing – no logging at all.
-
object
NoMarkerLogging
extends MarkerLoggingAdapter
NoLogging is a MarkerLoggingAdapter that does absolutely nothing – no logging at all.