@@ -35,6 +35,70 @@ For example, you can define the latest version in your `pom.xml` file:
3535</dependency>
3636--------------------------------------------------
3737
38+ === Log4j 2 Logger
39+
40+ You need to also include Log4j 2 dependencies:
41+
42+ ["source","xml",subs="attributes"]
43+ --------------------------------------------------
44+ <dependency>
45+ <groupId>org.apache.logging.log4j</groupId>
46+ <artifactId>log4j-api</artifactId>
47+ <version>2.6.2</version>
48+ </dependency>
49+ <dependency>
50+ <groupId>org.apache.logging.log4j</groupId>
51+ <artifactId>log4j-core</artifactId>
52+ <version>2.6.2</version>
53+ </dependency>
54+ --------------------------------------------------
55+
56+ And also provide a Log4j 2 configuration file in your classpath.
57+ For example, you can add in your `src/main/resources` project dir a `log4j2.properties` file like:
58+
59+
60+ ["source","properties",subs="attributes"]
61+ --------------------------------------------------
62+ appender.console.type = Console
63+ appender.console.name = console
64+ appender.console.layout.type = PatternLayout
65+ appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%m%n
66+
67+ rootLogger.level = info
68+ rootLogger.appenderRef.console.ref = console
69+ --------------------------------------------------
70+
71+ === Using another Logger
72+
73+ If you want to use another logger than Log4j 2, you can use http://www.slf4j.org/[SLF4J] bridge to do that:
74+
75+ ["source","xml",subs="attributes"]
76+ --------------------------------------------------
77+ <dependency>
78+ <groupId>org.apache.logging.log4j</groupId>
79+ <artifactId>log4j-to-slf4j</artifactId>
80+ <version>2.6.2</version>
81+ </dependency>
82+ <dependency>
83+ <groupId>org.slf4j</groupId>
84+ <artifactId>slf4j-api</artifactId>
85+ <version>1.7.21</version>
86+ </dependency>
87+ --------------------------------------------------
88+
89+ http://www.slf4j.org/manual.html[This page] lists implementations you can use. Pick your favorite logger
90+ and add it as a dependency. As an example, we will use the `slf4j-simple` logger:
91+
92+ ["source","xml",subs="attributes"]
93+ --------------------------------------------------
94+ <dependency>
95+ <groupId>org.slf4j</groupId>
96+ <artifactId>slf4j-simple</artifactId>
97+ <version>1.7.21</version>
98+ </dependency>
99+ --------------------------------------------------
100+
101+
38102== Dealing with JAR dependency conflicts
39103
40104If you want to use Elasticsearch in your Java application, you may have to deal with version conflicts with third party
0 commit comments