Skip to content

Commit 9918a7f

Browse files
committed
Use the duplicated logger and explain why
1 parent 01fb095 commit 9918a7f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

eclipse/org.mybatis.generator.eclipse.ui/antsrc/org/mybatis/generator/eclipse/ui/ant/logging/AntLogFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
import org.mybatis.generator.eclipse.ui.ant.logging.commons.JakartaCommonsLoggingLogFactory;
2222
import org.mybatis.generator.eclipse.ui.ant.logging.log4j2.Log4j2LoggingLogFactory;
23+
import org.mybatis.generator.eclipse.ui.ant.logging.slf4j.Slf4jLoggingLogFactory;
2324
import org.mybatis.generator.eclipse.ui.launcher.tabs.LoggingButtonData;
2425
import org.mybatis.generator.logging.AbstractLogFactory;
2526
import org.mybatis.generator.logging.Log;
2627
import org.mybatis.generator.logging.LogException;
2728
import org.mybatis.generator.logging.jdk14.Jdk14LoggingLogFactory;
2829
import org.mybatis.generator.logging.nologging.NoLoggingLogFactory;
29-
import org.mybatis.generator.logging.slf4j.Slf4jLoggingLogFactory;
3030

3131
/**
3232
* Factory for creating loggers

eclipse/org.mybatis.generator.eclipse.ui/antsrc/org/mybatis/generator/eclipse/ui/ant/logging/package-info.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@
1919
* in the base MyBatis Generator code. We need to duplicate them in the Eclipse plugin Ant runner
2020
* because of some complexities in plugin class loading.
2121
* <p>
22-
* We don't want the optional logging frameworks to always be on the plugin classpath. And the plugin
23-
* classpath cannot be altered at runtime. And the plugin classloader is a parent of the Ant classloader.
22+
* Classes in the antsupport JAR are loaded by the Ant classloader - which is a child of the plugin classloader.
23+
*
24+
* Only the Ant classloader will have the logging implementations that are added to the launch configuration
25+
* classpath.
26+
*
27+
* Any class that uses one of the optional logging implementations must also be loaded by the Ant classloader.
28+
* If we use the versions from the base library (loaded by the plugin classloader), they will not be able to see
29+
* the implementation JARs.
30+
*
2431
* All of this combines to mean that we need the logging implementations that have optional dependencies
2532
* to be loaded by the Ant classloader, rather than the plugin classloader - so we need them in this source
2633
* JAR rather than the main plugin JAR.

0 commit comments

Comments
 (0)