|
26 | 26 | import java.util.Map; |
27 | 27 |
|
28 | 28 | /** |
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. |
35 | 31 | * |
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> |
39 | 45 | * |
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 |
42 | 51 | * {@link #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY}. |
43 | 52 | */ |
44 | 53 | public abstract class Logger { |
@@ -162,7 +171,7 @@ public abstract class Logger { |
162 | 171 | private static final String LOG4J_OVER_SLF4J_TESTER_CLASS = "freemarker.log._Log4jOverSLF4JTester"; |
163 | 172 |
|
164 | 173 | // 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; |
166 | 175 |
|
167 | 176 | /** |
168 | 177 | * Order matters! Starts with the lowest priority. |
|
0 commit comments