+act,slf #11715 Add configurable LoggingFilter
* The filter is used by the LoggingAdapter before publishing to the event bus * Slf4jLoggingFilter uses backend log level configuration (e.g. logback.xml)
This commit is contained in:
parent
51062ff494
commit
813543e8f8
13 changed files with 285 additions and 46 deletions
|
|
@ -222,7 +222,9 @@ and it will receive the log events in the same order as they were emitted.
|
|||
|
||||
You can configure which event handlers are created at system start-up and listen to logging events. That is done using the
|
||||
``loggers`` element in the :ref:`configuration`.
|
||||
Here you can also define the log level.
|
||||
Here you can also define the log level. More fine grained filtering based on the log source
|
||||
can be implemented in a custom ``LoggingFilter``, which can be defined in the ``logging-filter``
|
||||
configuration property.
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
|
|
@ -245,8 +247,6 @@ Example of creating a listener:
|
|||
.. includecode:: code/docs/event/LoggingDocTest.java
|
||||
:include: my-event-listener
|
||||
|
||||
.. _slf4j-java:
|
||||
|
||||
Logging to stdout during startup and shutdown
|
||||
=============================================
|
||||
|
||||
|
|
@ -255,6 +255,8 @@ Instead log messages are printed to stdout (System.out). The default log level f
|
|||
stdout logger is ``WARNING`` and it can be silenced completely by setting
|
||||
``akka.stdout-loglevel=OFF``.
|
||||
|
||||
.. _slf4j-java:
|
||||
|
||||
SLF4J
|
||||
=====
|
||||
|
||||
|
|
@ -269,16 +271,19 @@ It has one single dependency; the slf4j-api jar. In runtime you also need a SLF4
|
|||
<version>1.0.13</version>
|
||||
</dependency>
|
||||
|
||||
You need to enable the Slf4jLogger in the 'loggers' element in
|
||||
You need to enable the Slf4jLogger in the ``loggers`` element in
|
||||
the :ref:`configuration`. Here you can also define the log level of the event bus.
|
||||
More fine grained log levels can be defined in the configuration of the SLF4J backend
|
||||
(e.g. logback.xml).
|
||||
(e.g. logback.xml). You should also define ``akka.event.slf4j.Slf4jLoggingFilter`` in
|
||||
the ``logging-filter`` configuration property. It will filter the log events using the backend
|
||||
configuration (e.g. logback.xml) before they are published to the event bus.
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
akka {
|
||||
loggers = ["akka.event.slf4j.Slf4jLogger"]
|
||||
loglevel = "DEBUG"
|
||||
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
|
||||
}
|
||||
|
||||
One gotcha is that the timestamp is attributed in the event handler, not when actually doing the logging.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue