I have a web application in spring boot + Hibernate + Log4j deployed in JBOSS. All the hibernate sql queries are getting logged in server.log if we use "spring.jpa.show-sql = true" in application.properties. As per the Hibernate Log4j instruction we need to turn this property to false so that sql statements will get logged in separate log file as per Log4j configuration. If we turn it to false then also sql statements are not logged in separate log file. All other application related logs are getting logged in separate log file except hibernate logs. Please help to get this issue resolved.

```
Below is the entry in application.properties file.
spring.jpa.show-sql = false
spring.jpa.open-in-view=false
spring.datasource.ucm.default-auto-commit=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.id.new_generator_mappings=false  
spring.jackson.serialization.fail-on-empty-beans=false

# SQL statements and parameters
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql=trace

```

Log4j2.xml

```
<?xml version="1.0" encoding="UTF-8"?>
<Configuration  monitorInterval="30">

<Properties>
    <Property name="LOG_PATTERN">%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} %p %m%n
    </Property>
    <Property name="APP_LOG_ROOT">c:/log/VendorPortal</Property>
</Properties>

<Appenders>

    <Console name="console" target="SYSTEM_OUT" follow="false">
        <PatternLayout pattern="${LOG_PATTERN}" />
    </Console>

    <!-- File Appender -->
    <RollingFile name="RollingFile"
        fileName="c:/log/vendorportal.log"
        filePattern="c:/log/vendorportal-%d{MM-dd-yyyy}.log"
        ignoreExceptions="false">
        <PatternLayout>
            <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
        </PatternLayout>
        <Policies>
            <TimeBasedTriggeringPolicy />
            <SizeBasedTriggeringPolicy size="100 MB" />
        </Policies>
    </RollingFile>

    <Console name="STDOUT" target="SYSTEM_OUT"
        ignoreExceptions="false">
        <PatternLayout pattern="%m%n" />
    </Console>

</Appenders>

<Loggers>

    <Logger name="org.springframework" additivity="false"
        level="error">
        <AppenderRef ref="RollingFile" />
    </Logger>

    <Logger name="org.hibernate" level="info" additivity="false">
        <AppenderRef ref="RollingFile" />
    </Logger>

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

    <Logger name="org.hibernate.type.descriptor.sql" level="TRACE"
        additivity="false">
        <AppenderRef ref="RollingFile" />
    </Logger>

    <Root level="error">
        <AppenderRef ref="console" />
        <AppenderRef ref="RollingFile" />
    </Root>

</Loggers>

</Configuration>

```

pom.xml

```
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-core</artifactId>

        </dependency>
    <dependency>
         <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
     <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
</dependency>

```