Skip to content

Commit 9468a08

Browse files
committed
Improved Logger javadoc.
1 parent 33d5094 commit 9468a08

File tree

1 file changed

+21
-12
lines changed
  • freemarker-core/src/main/java/freemarker/log

1 file changed

+21
-12
lines changed

freemarker-core/src/main/java/freemarker/log/Logger.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,28 @@
2626
import java.util.Map;
2727

2828
/**
29-
* Delegates logger creation to an actual logging library. By default it looks for logger libraries in this order (in
30-
* FreeMarker 2.3.x): Log4J, Avalon LogKit, JUL (i.e., {@code java.util.logging}). Prior to FreeMarker 2.4, SLF4J and
31-
* Apache Commons Logging aren't searched automatically due to backward compatibility constraints. But if you have
32-
* {@code log4j-over-slf4j} properly installed (means, you have no real Log4j in your class path, and SLF4J has a
33-
* backing implementation like {@code logback-classic}), then FreeMarker will use SLF4J directly instead of Log4j (since
34-
* FreeMarker 2.3.22).
29+
* Delegates logger creation to an actual logging library (this was written before SLF4J, or even Apache Commons Logging
30+
* was widespread). This is used by FreeMarker internally for logging.
3531
*
36-
* NOTE: When running on GraalVM native image (system property 'org.graalvm.nativeimage.imagecode' set),
37-
* FreeMarker 2.4 behaviour will be anticipated (SLF4J / Apache Commons are auto-detected).
38-
* Additionally, log4j-over-slf4j lookup is skipped.
32+
* <p>By default, it looks for logger classes via reflection, in the below order, and picks the first one that it
33+
* founds:
34+
* <ol>
35+
* <li>SLF4J:
36+
* <b>Skipped for backward compatibility</b>, except under GraalVM native, and FreeMarker 2.4.x (planned).
37+
* </li>
38+
* <li>Apache Commons Logging:
39+
* <b>Skipped for backward compatibility</b>, except under GraalVM native, and FreeMarker 2.4.x (planned).
40+
* </li>
41+
* <li>Log4J</li>
42+
* <li>Avalon LogKit</li>
43+
* <li>JUL (i.e., {@code java.util.logging})</li>
44+
* </ol>
3945
*
40-
* <p>
41-
* If the auto detection sequence describet above doesn't give you the result that you want, see
46+
* <p>Furthermore, if you have {@code log4j-over-slf4j} properly installed (means, you have no real Log4j in your class
47+
* path, and SLF4J has a backing implementation like {@code logback-classic}), then FreeMarker will use SLF4J directly
48+
* instead of Log4j (since FreeMarker 2.3.22). (This trick is, of course, irrelevant if SLF4J lookup is not skipped.)
49+
*
50+
* <p>If the auto-detection rule described above doesn't give you the result that you want, see
4251
* {@link #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY}.
4352
*/
4453
public abstract class Logger {
@@ -162,7 +171,7 @@ public abstract class Logger {
162171
private static final String LOG4J_OVER_SLF4J_TESTER_CLASS = "freemarker.log._Log4jOverSLF4JTester";
163172

164173
// it is true if running in a GraalVM native build (issue #229) - see https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/ImageInfo.html#PROPERTY_IMAGE_CODE_KEY
165-
private static final boolean IS_GRAALVM_NATIVE = System.getProperty( "org.graalvm.nativeimage.imagecode" ) != null;
174+
private static final boolean IS_GRAALVM_NATIVE = System.getProperty("org.graalvm.nativeimage.imagecode") != null;
166175

167176
/**
168177
* Order matters! Starts with the lowest priority.

0 commit comments

Comments
 (0)