2

logQuery is called in prepareStatementAndSetParameters mehtod - SQLInsertClause class

   protected void logQuery(Logger logger, String queryString, Collection<Object> parameters) {
        String normalizedQuery = queryString.replace('\n', ' ');
        MDC.put(QueryBase.MDC_QUERY, normalizedQuery);
        MDC.put(QueryBase.MDC_PARAMETERS, String.valueOf(parameters));
        if (logger.isDebugEnabled()) {
            logger.debug(normalizedQuery);
        }
    }

how can I set debug level to logger ?

Joqkey
  • 21
  • 1
  • 4

1 Answers1

0

That logger there is from SLF4J API. Depending on the logger you have behind the API you use facilities of that underlying logging implementation.

For instance we use Logback Classic (dependency ch.qos.logback:logback-classic) and I can explicitly override what configuration file to use with -Dlogback.configurationFile=devel-logback.xml in JVM parameters. Default mechanism is documented here. My file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date %level [%.60thread] %logger{1} %msg%n</pattern>
        </encoder>
    </appender>

    <logger name="com.mysema.query.jpa.impl.JPAQuery" level="DEBUG"/>
    <!-- more loggers -->

    <root level="DEBUG">
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration>

Also adding -Dlogback.debug=true to JVM arguments adds some debug output when logback is being initialized.

virgo47
  • 2,283
  • 24
  • 30