|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.event.Logging
public class 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 in akka.conf
by setting (some of) the following:
akka {
event-handlers = ["akka.slf4j.Slf4jEventHandler"] # for example
loglevel = "INFO" # used when normal logging ("event-handlers") has been started
stdout-loglevel = "WARN" # used during application start-up until normal logging is available
}
Nested Class Summary | |
---|---|
static class |
Logging.Debug
For DEBUG Logging |
static class |
Logging.Debug$
|
static class |
Logging.DefaultLogger
Actor wrapper around the standard output logger. |
static class |
Logging.Error
For ERROR Logging |
static class |
Logging.Error$
|
static class |
Logging.EventHandlerException
Artificial exception injected into Error events if no Throwable is supplied; used for getting a stack dump of error locations. |
static class |
Logging.Info
For INFO Logging |
static class |
Logging.Info$
|
static class |
Logging.InitializeLogger
Message which is sent to each default logger (i.e. from configuration file) after its creation but before attaching it to the logging bus. |
static class |
Logging.InitializeLogger$
|
static interface |
Logging.LogEvent
Base type of LogEvents |
static class |
Logging.LogEventException
Exception that wraps a LogEvent. |
static class |
Logging.LoggerInitializationException
LoggerInitializationException is thrown to indicate that there was a problem initializing a logger |
static class |
Logging.LoggerInitialized
Response message each logger must send within 1 second after receiving the InitializeLogger request. |
static class |
Logging.LoggerInitialized$
|
static class |
Logging.LogLevel
Marker trait for annotating LogLevel, which must be Int after erasure. |
static class |
Logging.LogLevel$
|
static class |
Logging.StandardOutLogger
Actor-less logging implementation for synchronous logging to standard output. |
static interface |
Logging.StdOutLogger
|
static class |
Logging.Warning
For WARNING Logging |
static class |
Logging.Warning$
|
Constructor Summary | |
---|---|
Logging()
|
Method Summary | ||
---|---|---|
static scala.collection.Seq<Logging.LogLevel> |
AllLogLevels()
|
|
static
|
apply(ActorSystem system,
T logSource,
LogSource<T> evidence$3)
Obtain LoggingAdapter for the given actor system and source object. |
|
static
|
apply(LoggingBus bus,
T logSource,
LogSource<T> evidence$4)
Obtain LoggingAdapter for the given logging bus and source object. |
|
static java.lang.Class<? extends Logging.LogEvent> |
classFor(Logging.LogLevel level)
Returns the event class associated with the given LogLevel |
|
static Logging.LogLevel |
DebugLevel()
|
|
static Logging.LogLevel |
ErrorLevel()
Log level in numeric form, used when deciding whether a certain log statement should generate a log event. |
|
static LoggingAdapter |
getLogger(ActorSystem system,
java.lang.Object logSource)
Obtain LoggingAdapter for the given actor system and source object. |
|
static LoggingAdapter |
getLogger(LoggingBus bus,
java.lang.Object logSource)
Obtain LoggingAdapter for the given logging bus and source object. |
|
static Logging.LogLevel |
InfoLevel()
|
|
static Logging.LogLevel |
levelFor(java.lang.Class<? extends Logging.LogEvent> eventClass)
Returns the LogLevel associated with the given event class. |
|
static scala.Option<Logging.LogLevel> |
levelFor(java.lang.String s)
Returns the LogLevel associated with the given string, valid inputs are upper or lowercase (not mixed) versions of: "error", "warning", "info" and "debug" |
|
static Logging.LoggerInitialized$ |
loggerInitialized()
Java API to create a LoggerInitialized message. |
|
static Logging.Error.NoCause$ |
noCause()
Null Object used for errors without cause Throwable |
|
static java.lang.String |
simpleName(java.lang.Class<?> clazz)
Returns a 'safe' getSimpleName for the provided Class |
|
static java.lang.String |
simpleName(java.lang.Object obj)
Returns a 'safe' getSimpleName for the provided object's Class |
|
static java.lang.String |
stackTraceFor(java.lang.Throwable e)
Returns the StackTrace for the given Throwable as a String |
|
static Logging.StandardOutLogger |
StandardOutLogger()
|
|
static Logging.LogLevel |
WarningLevel()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Logging()
Method Detail |
---|
public static java.lang.String simpleName(java.lang.Object obj)
obj
-
public static java.lang.String simpleName(java.lang.Class<?> clazz)
obj
-
public static final Logging.LogLevel ErrorLevel()
public static final Logging.LogLevel WarningLevel()
public static final Logging.LogLevel InfoLevel()
public static final Logging.LogLevel DebugLevel()
public static scala.Option<Logging.LogLevel> levelFor(java.lang.String s)
public static Logging.LogLevel levelFor(java.lang.Class<? extends Logging.LogEvent> eventClass)
public static java.lang.Class<? extends Logging.LogEvent> classFor(Logging.LogLevel level)
public static scala.collection.Seq<Logging.LogLevel> AllLogLevels()
public static <T> LoggingAdapter apply(ActorSystem system, T logSource, LogSource<T> evidence$3)
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 LogSource
for details.
You can add your own rules quite easily, see LogSource
.
public static <T> LoggingAdapter apply(LoggingBus bus, T logSource, LogSource<T> evidence$4)
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 LogSource
for details.
You can add your own rules quite easily, see LogSource
.
public static LoggingAdapter getLogger(ActorSystem system, java.lang.Object logSource)
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 LogSource
for details.
public static LoggingAdapter getLogger(LoggingBus bus, java.lang.Object logSource)
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 LogSource
for details.
public static Logging.Error.NoCause$ noCause()
public static Logging.LoggerInitialized$ loggerInitialized()
public static Logging.StandardOutLogger StandardOutLogger()
public static java.lang.String stackTraceFor(java.lang.Throwable e)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |