- 21 Oct 2019
To get the Logging of a Spring-Boot webapplication/restservice directed to graylog, you need to add in a first step the folowing dependency to your project's pom:
<version>14.0.0</version> <!--as of 21.10.2019. -->
The trivial way to provide a configuration file for the Log4j2 Framework
In a second step, you have to copy one of the log4j2-
.xml* configuration file to the src/main/resources
of your project and rename it to log4j2.xml
: please note that, as of 21.10.2019 only log4j2-dev.xml
are logging to graylog using INFO level.
A better alternative
As a better alternative: you have just to indicate in the application.properties
which of the log4j2-
.xml* configuration file contained in the common-dependencies-x.x.x.jar
shall be used to configure the Log4j2 framework.
How to do it
to achieve this goal, just provide the name of the configuration-file to use as the value for the parameter logging.config
: et voilà!
Of course you don't need to copy the configuration file to the src/main/resources
of your project.