New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot apply changes a logging implementation at some class #1272

Closed
kazuki43zoo opened this Issue May 4, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@kazuki43zoo
Copy link
Member

kazuki43zoo commented May 4, 2018

MyBatis version

3.4.6 (Probably all versions)

Database vendor and version

Any

Test case or example project

None

Steps to reproduce

  1. Change to JKD14 as follow:
sqlSessionFactory.getConfiguration().setAutoMappingUnknownColumnBehavior(AutoMappingUnknownColumnBehavior.WARNING);
sqlSessionFactory.getConfiguration().setLogImpl(Jdk14LoggingImpl.class); // Change to JDK14
  1. Run an application

Expected result

Output a log using the logger of JDK14(via specified log implementation).

Actual result

But output a log using the logger of SLF4J(In my application, SLF4J's provider is log4j). this changes cannot apply to some class.

@kazuki43zoo kazuki43zoo added the bug label May 4, 2018

@kazuki43zoo

This comment has been minimized.

Copy link
Member Author

kazuki43zoo commented May 4, 2018

In this current implementation, the logger initialization has been performed before applying a logger configuration.

For example:

private static final Log log = LogFactory.getLog(AutoMappingUnknownColumnBehavior.class);

private static final Log log = LogFactory.getLog(JavassistProxyFactory.class);

Loggers of these classes has been initialized before applying logger configuration because the Configuration class refers these classes.

kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this issue May 4, 2018

Fix log initialization timing
* Support the lazy initialization log
* Move the log configuration timing for xml config

Fixes mybatisgh-1272

kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this issue May 4, 2018

Fix log initialization timing
* Support the lazy initialization log
* Move the log configuration timing for xml config

Fixes mybatisgh-1272

kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this issue May 4, 2018

Fix log initialization timing
* Support the lazy initialization log
* Move the log configuration timing for xml config

Fixes mybatisgh-1272

@kazuki43zoo kazuki43zoo self-assigned this Dec 9, 2018

@kazuki43zoo kazuki43zoo added this to the 3.5.0 milestone Dec 9, 2018

kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this issue Dec 9, 2018

kazuki43zoo added a commit that referenced this issue Dec 9, 2018

Merge pull request #1395 from kazuki43zoo/gh-1272
Fix log initialization timing on some class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment