[id='enabling_json_logging-{context}']
= Enabling and Configuring the JSON Log Handler
{brandname} provides a JSON log handler to write messages in JSON format.

.Prerequisites
Ensure that {brandname} is not running. You cannot dynamically enable log handlers.

.Procedure
. Open `{server_home}/${infinispan.server.root}/conf/log4j2.xml` with any text editor.
. Uncomment the `JSON-FILE` appender and comment out the `FILE` appender:
+
[source,xml,options="nowrap",subs=attributes+]
----
      <!--<AppenderRef ref="FILE"/>-->
      <AppenderRef ref="JSON-FILE"/>
----
+
. Optionally configure the JSON
link:https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender[appender]
and
link:https://logging.apache.org/log4j/2.x/manual/layouts.html#JSONLayout[ layout].
. Save and close `logging.properties`.

When you start {brandname}, it writes each log message as a JSON map in the following file: +
`{server_home}/${infinispan.server.root}/log/server.log.json`
