-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Anyone having problems with Latest Hibernate and Log4j2?
PostPosted: Thu Apr 27, 2017 7:34 pm 
Newbie

Joined: Mon Oct 10, 2005 10:58 pm
Posts: 7
We have been having challenges trying to get the latest hibernate 5.2.9 going to our log4j2 log files using log4j 2.8. Hibernate appears to only be logging to sysout at this point no matter what we do.

To avoid dumping our large pom file to troubleshoot, I thought maybe someone can post a recent pom configuration they know is working with log4j(2) and hibernate 5.2.9 that I could try.

Also, if there is anything else beyond the maven dependency we have to watch out for or other configuration steps we need to take, please let me know.

We did do some amount of searching around on the net and trying several configurations but did not have much luck.

Thanks for any help in advance.


Top
 Profile  
 
 Post subject: Re: Anyone having problems with Latest Hibernate and Log4j2?
PostPosted: Mon May 01, 2017 3:31 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I just tested it with the following dependencies:

Code:
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.8.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.8.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.8.2</version>
        </dependency>


And this log4j2 config:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <File name="MyFile" fileName="logs/app.log">
            <PatternLayout>
                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
            </PatternLayout>
        </File>
    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="MyFile"/>
        </Root>
        <Logger name="org.hibernate" level="debug"/>
        <Logger name="org.hibernate.SQL" level="debug"/>
        <Logger name="com.zaxxer.hikari" level="debug" />
    </Loggers>
</Configuration>


And it woks just fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.