Configure log hibernate in test to a file?

0

I want to configure the log of the queries of hibernate when I launch the unit tests to a log file.

This configuration displayed on the server works like a charm but when I run the tests the hibernate traces are painted without the package name and in the Eclipse console.

On the server:

2018-01-12 15:28:54,708 DEBUG (org.hibernate.engine.jdbc.spi.SqlStatementLogger:logStatement:109) - 

In the tests:

Hibernate: select ... el_resto_de_la_query

Configuration log4j.xml

    <RollingFile name="SQLAppender" fileName="${FilePath}/sql.log"
        filePattern="${FilePath}/old/sql_%d{yyyyMMdd}_%i.log.gz"
        append="true">
        <Policies>
            <TimeBasedTriggeringPolicy />
            <SizeBasedTriggeringPolicy size="250 MB" />
        </Policies>
        <DefaultRolloverStrategy max="5" />
        <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p (%C:%M:%L) - %m%n" />
    </RollingFile>


    <Logger name="org.hibernate.SQL" level="DEBUG" additivity="false">
        <AppenderRef ref="SQLAppender" />
    </Logger>

    <Logger name="org.hibernate.type" level="INFO" additivity="false">
        <AppenderRef ref="SQLAppender" />
    </Logger>
    
asked by Zawarudo 26.01.2018 в 13:36
source

0 answers