Fix docs for using YAML to configure Log4J 2

Previously, the documentation stated that jackson-dataformat-yaml was
the only required dependency. This is incorrect. jackson-databind is
also required.

Closes gh-4924
This commit is contained in:
Andy Wilkinson 2016-01-15 12:51:19 +00:00
parent b56eef236e
commit 2f2bba4d26

View File

@ -1259,14 +1259,25 @@ samples for more detail and to see it in action.
[[howto-configure-log4j-for-logging-yaml-or-json-config]]
==== Use YAML or JSON to configure Log4j 2
In addition to its default XML configuration format, Log4j 2 also supports YAML and JSON
configuration files. To configure Log4j 2 to use an alternative configuration file format
all you need to do is add an appropriate dependency to the classpath. To use YAML, add a
dependency on `com.fasterxml.jackson.dataformat:jackson-dataformat-yaml` and Log4j 2 will
look for configuration files names `log4j2.yaml` or `log4j2.yml`. To use JSON, add a
dependency on `com.fasterxml.jackson.core:jackson-databind` and Log4j 2 will look for
configuration files named `log4j2.json` or `log4j2.jsn`
configuration files. To configure Log4j 2 to use an alternative configuration file format,
add the appropriate dependencies to the classpath and name your
configuration files to match your chosen file format:
[cols="10,75,15"]
|===
|Format|Dependencies|File names
|YAML
a| `com.fasterxml.jackson.core:jackson-databind` +
`com.fasterxml.jackson.dataformat:jackson-dataformat-yaml`
a| `log4j2.yaml` +
`log4j2.yml`
|JSON
a| `com.fasterxml.jackson.core:jackson-databind`
a| `log4j2.json` +
`log4j2.jsn`
|===
[[howto-data-access]]
== Data Access