diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html index e56bc9abc..c76e4e9e0 100644 --- a/slf4j-site/src/site/pages/faq.html +++ b/slf4j-site/src/site/pages/faq.html @@ -714,7 +714,7 @@
In the rare case where the "\{}' occurs naturally in the +
In the rare case where the "\{}" occurs naturally in the message, you can double escape the formatting anchor so that it retains its original meaning. For example,
@@ -1026,10 +1026,7 @@transient
- Static logger members cost a single variable reference for @@ -1141,25 +1133,25 @@
Logger serialization
Contrary to static variables, instance variables are - serialized by default. However, the org.sfl4j.Logger interface - is not serializable nor are the logger classes in underlying - logging systems such as java.util.logging, log4j or - logback-classic. -
- + serialized by default. As of SLF4J version 1.5.3, logger + instances survive serialization. Thus, serialization of the host + class no longer requires any special action, even when loggers + are declared as instance variables. In previous versions, logger + instances needed to be declared astransient
in the
+ host class.
Summary
In summary, declaring logger members as static variables - requires less work, less CPU and memory overhead and causes no - problems with serialization. On the other hand, declaring logger - members as instance variables requires more work, more CPU and - memory overhead and is likely to cause problems with - serialization. However, instance variables make it possible to - create a distinct logger environment for each application, even - for loggers declared in shared libraries. Perhaps more important - than previously mentioned considerations, instance variables are - IOC-friendly whereas static variables are not. + requires less CPU time and have a slightly smaller memory + footprint. On the other hand, declaring logger members as + instance variables requires more CPU time and have a slighlty + higher memory overhead. However, instance variables make it + possible to create a distinct logger environment for each + application, even for loggers declared in shared + libraries. Perhaps more important than previously mentioned + considerations, instance variables are IOC-friendly whereas + static variables are not.