public class Slf4jLogger extends java.lang.Object implements Actor, SLF4JLogging, RequiresMessageQueue<LoggerMessageQueueSemantics>
The thread in which the logging was performed is captured in Mapped Diagnostic Context (MDC) with attribute name "sourceThread".
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
Slf4jLogger() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
actorSystemName() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
protected java.lang.String |
formatTimestamp(long timestamp)
Override this method to provide a differently formatted timestamp
|
org.slf4j.Logger |
log() |
java.lang.String |
mdcActorSystemAttributeName() |
java.lang.String |
mdcAkkaSourceAttributeName() |
java.lang.String |
mdcAkkaTimestamp() |
java.lang.String |
mdcThreadAttributeName() |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
void |
withMdc(java.lang.String logSource,
Logging.LogEvent logEvent,
scala.Function0<scala.runtime.BoxedUnit> logStatement) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, preStart, sender, supervisorStrategy, unhandled
public org.slf4j.Logger log()
log
in interface SLF4JLogging
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public java.lang.String mdcThreadAttributeName()
public java.lang.String mdcActorSystemAttributeName()
public java.lang.String mdcAkkaSourceAttributeName()
public java.lang.String mdcAkkaTimestamp()
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public final void withMdc(java.lang.String logSource, Logging.LogEvent logEvent, scala.Function0<scala.runtime.BoxedUnit> logStatement)
protected java.lang.String formatTimestamp(long timestamp)
timestamp
- a "currentTimeMillis"-obtained timestamppublic java.lang.String actorSystemName()