I'm trying to understand how to have and configure logging with MyBatis, Spring MVC and Log4J2 on Wildfly.
My problem is to understand how to set up MyBatis which, at the moment, is ignoring my Log4J2 configuration and I want to set up it with Java only.
org.apache.ibatis.session.Configuration seems to be the class I need and i found how to set some configurations, like JdbcTypeForNull. I found to set Log4J2 (setLogImpl(Log4j2Impl.class)) but I've already done this with
org.apache.ibatis.logging.LogFactory.useLog4J2Logging();
What I'm not understanding is why MyBatis ignores my log4j2.properties file and says:
Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration
This is my log4j2.properties
name=LoggingConfig
property.filename = logs
appenders = console, file
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} %c{1} - %msg
appender.file.type = File
appender.file.name = LOGFILE
appender.file.fileName=../LOGS/logs.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg
loggers=console
logger.console.name=myPrj.database.mybatis.mappers
logger.console.level=DEBUG
logger.console.additivity=true
logger.console.appenderRef.console.ref = STDOUT
logger.console.myPrj.database.mybatis.mappers.MainMapper=TRACE
rootLogger.level = ALL
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT
Any advice? I found the offical docs really poor, with only xml configuration and only with log4j.