Browse Source

Init logging in VaadinServlet instead of an UI (#11525)

If you use multiple UIs, the use of SLF4J would depend on the UI initialization order which could be pretty random. If you have multiple servlets, it's even better to init SLF4J in ServletContextListener.
tags/8.8.0.beta1
Martin Vysny 5 years ago
parent
commit
7d2b6cafc5
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      documentation/advanced/advanced-logging.asciidoc

+ 4
- 5
documentation/advanced/advanced-logging.asciidoc View File

@@ -57,11 +57,9 @@ to log the actual messages using Log4j. For more info on this, please visit the
SLF4J site.

In order to get the [package]#java.util.logging# to SLF4J bridge installed, you
need to add the following snippet of code to your [classname]#UI# class at the
need to add the following snippet of code to your [classname]#VaadinServlet# class at the
very top:

//TODO: Sure it's UI class and not the servlet?

[source, java]
----
static {
@@ -70,8 +68,9 @@ very top:
----

This will make sure that the bridge handler is installed and working before
Vaadin starts to process any logging calls.

Vaadin starts to process any logging calls. If your app consists of multiple servlets,
you should initialize the SLF4J logging in a [classname]#ServletContextListener# instead,
so that the servlets' initialization methods uses the proper logger.

[WARNING]
.Please note!

Loading…
Cancel
Save