You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -80,15 +81,19 @@ and xref:configuration/configuration-settings.adoc#config_db.logs.query.threshol
80
81
Neo4j uses https://logging.apache.org/log4j/2.x/[Log4j 2] for logging.
81
82
The logging configuration is located in the _conf_ directory and consists of two files:
82
83
83
-
* _user-log.xml_ -- provides configuration for _neo4j.log_.
84
+
* _user-logs.xml_ -- provides configuration for _neo4j.log_.
84
85
* _server-logs.xml_ -- provides configuration for _debug.log_, _http.log_, _query.log_, and _security.log_.
85
86
86
87
The _gc.log_ is handled by the Java Virtual Machine(JVM) and is configured using the JVM parameters.
87
88
For details, see <<garbage-collection-log-file-configuration>>.
88
89
89
-
[TIP]
90
+
[json-format]
91
+
[NOTE]
90
92
====
91
-
If you want to use a custom directory for your Log4j configuration files, set the new paths to your XML files in the _neo4j.conf_ file by using the parameters xref:configuration/configuration-settings.adoc#config_server.logs.user.config[`server.logs.user.config`] and xref:configuration/configuration-settings.adoc#config_server.logs.config[`server.logs.config`].
93
+
Starting from Noe4j 2025.01, the default configuration files are located in the _server.directories.configuration=conf_ directory.
94
+
Therefore, the default paths to the configuration files are _<home>/conf/user-logs.xml_ and _<home>/conf/server-logs.xml_.
95
+
If you use a custom directory for your Log4j configuration files, update the paths to your XML files in the _neo4j.conf_ file to depend on <conf> rater than <home>.
96
+
For example, xref:configuration/configuration-settings.adoc#config_server.logs.user.config[`server.logs.user.config=path/to/your/conf/user-logs.xml`] and xref:configuration/configuration-settings.adoc#config_server.logs.config[`server.logs.config=path/to/your/conf/server-logs.xml`].
92
97
====
93
98
94
99
Each configuration file comprises two main elements: _Appenders_ and _Loggers_:
@@ -113,14 +118,14 @@ For more details, see https://logging.apache.org/log4j/2.x/manual/configuration.
113
118
114
119
The following example shows the default configuration of the _user-logs.xml_ file.
@@ -277,30 +288,36 @@ See <<general-logging-appenders>> for more information.
277
288
<4> `filePattern` specifies a file pattern to be used when the file is rolled.
278
289
The pattern renames the files to _debug.log.01_ and _http.log.01_ when they reach the defined trigger.
279
290
280
-
<5> `PatternLayout` defines the layout for the appender, in this case with the `GMT+2` timezone.
291
+
<5> The `JsonTemplateLayout` layout is used to format the log messages in JSON format.
292
+
Starting from Neo4j 2025.01, the default _debug.log_ format is JSON, and it is recommended to keep it enabled to ensure the best support.
293
+
If you require the _debug.log_ messages in a different format, create an additional Appender since the default one is used by the Neo4j Support team.
294
+
If you require to use the text format, you can uncomment entry <6>.
295
+
296
+
<6> `PatternLayout` defines the layout for the appender, in this case, with the `GMT+2` timezone.
297
+
Note that this is used in the 5.x series and is now disabled by default.
281
298
See <<general-logging-log-layout>> for more information.
282
299
283
-
<6> The `Policies` element defines when the files are rolled and how many files to keep as history before they are deleted.
300
+
<7> The `Policies` element defines when the files are rolled and how many files to keep as history before they are deleted.
284
301
285
-
<7> The `SizeBasedTriggeringPolicy` defines when the files are rolled.
302
+
<8> The `SizeBasedTriggeringPolicy` defines when the files are rolled.
286
303
In this case, when the size of the files reaches 20 MB, the files are renamed according to the `filePattern`, and the log files start over.
287
304
In Neo4j 4.0, this was configured with the parameter `dbms.logs.user.rotation.size`.
288
305
289
-
<8> The `DefaultRolloverStrategy` defines how many files to keep as history. +
306
+
<9> The `DefaultRolloverStrategy` defines how many files to keep as history. +
290
307
The `fileIndex=min` implies that the minimum/the lowest number is the most recent one. +
291
308
The `max` attribute defines the number of files to keep as history before they are deleted, in this case, 7 files.
292
309
In Neo4j 4.0, this was configured with the parameter `dbms.logs.user.rotation.keep_number`.
293
310
294
-
<9> Loggers are used to define the log level and which appender to use for the log messages.
311
+
<10> Loggers are used to define the log level and which appender to use for the log messages.
295
312
The loggers are referenced by the `name` attribute.
296
313
See <<general-logging-loggers>> for more information.
297
314
298
-
<10> The root logger is a "catch-all" logger that catches everything that is not caught by the other loggers and sends it to the appender(s) specified in the `AppenderRef` element(s).
315
+
<11> The root logger is a "catch-all" logger that catches everything that is not caught by the other loggers and sends it to the appender(s) specified in the `AppenderRef` element(s).
299
316
The root logger is referenced by the `Root` element.
300
317
It can be set to `DEBUG`, `INFO`, `WARN`, `ERROR`, or `OFF`.
301
318
The default log level is `INFO`.
302
319
303
-
<11> You can also define custom loggers to catch specific log events and send them to the appender(s) specified in the `AppenderRef` element(s).
320
+
<12> You can also define custom loggers to catch specific log events and send them to the appender(s) specified in the `AppenderRef` element(s).
304
321
For example, the `QueryLogger` logger (configured in _server-logs.xml_) is used to catch log events with a log level of `INFO` or above and send them to the `QueryLog` appender. +
305
322
The `additivity="false"` is set to fully consume the log event and not send it to the root logger. +
306
323
If `additivity="true"` is set, which is the default, the log event is also sent to the root logger.
@@ -428,23 +445,16 @@ a| `%n`
428
445
429
446
For all available converters, consult the https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout[Log4j 2 Pattern Layout documentation].
430
447
431
-
[[general-logging-debug-log-pattern]]
432
-
==== `<Neo4jDebugLogLayout>`
433
-
434
-
The `<Neo4jDebugLogLayout>` layout is essentially the same as the xref:monitoring/logging.adoc#general-logging-pattern-layout[`PatternLayout`].
435
-
The main difference is that a header is injected at the start of the log file with diagnostic information useful for Neo4j developers.
436
-
This layout should typically only be used for the _debug.log_ file.
0 commit comments