Skip to content

Commit 380e89b

Browse files
authored
Merge pull request #51723 from gsmet/warn-dynamic-logging
Add a warning about using dynamic names for Loggers
2 parents 5aaebe5 + b76a50d commit 380e89b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/src/main/asciidoc/logging.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public class MyService {
109109
<1> Define the logger field.
110110
<2> Invoke the desired logging methods on the `log` object.
111111

112+
[WARNING]
113+
====
114+
When creating a `Logger` instance, some metadata associated to the `Logger` name are kept in memory for the full lifecycle of the application.
115+
116+
It is not recommended to use an unbounded dynamic name for your loggers (e.g. `for (int i ...) { Logger.getLogger("logger-name." + i).info("my log") }`).
117+
====
112118

113119
[[simplified-logging]]
114120
=== Simplified logging

0 commit comments

Comments
 (0)