You are here: Foswiki>Service Web>DirectLoggingToGraylog (21 Oct 2019, MezianeKettou)Edit Attach
-- MezianeKettou - 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:
<dependency>
  <groupId>de.gsi.fcc.commons</groupId>
  <artifactId>common-dependencies</artifactId>
  <version>14.0.0</version> <!--as of 21.10.2019. -->
</dependency>

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 and log4j2-pro.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Ă !
logging.config=classpath:log4j2-pro.xml 

Of course you don't need to copy the configuration file to the src/main/resources of your project.
Topic revision: r2 - 21 Oct 2019, MezianeKettou
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback