[hibernate-dev] Hibernate + Log4J2 Performance Problem

Petar Tahchiev paranoiabla at gmail.com
Fri Jul 11 08:44:04 EDT 2014


Hi Sanne,

yes, as you can see:
-------------------------------------------------
So I got rid of this dependency and I added the jboss-logging. So now
here's my set of jars:

hibernate-core
hibernate-entitymanager
hibernate-c3p0
hibernate-validator
log4j2
org.jboss.logging:jboss-logging:jar:3.2.0.Beta1
-----------------------------------------
I have log4j2 and jboss-logging:jar:3.2.0.Beta1

I upgraded to version 3.2.0.Beta1 because this bug

https://issues.jboss.org/browse/JBLOGGING-95

mentions that it was fixed in this version.



2014-07-11 15:17 GMT+03:00 Sanne Grinovero <sanne at hibernate.org>:

> Hi,
> I never tried Log4j2 myself, but while excluding all jboss-logging
> artifacts, are you making sure you keep at least one (compatible)
> version of it?
> You need JBoss Logging to log anything, even if you re-route the
> actual output to a different logger, as that's what Hibernate will use
> as primary façade.
>
> HTH
> Sanne
>
> On 11 July 2014 12:53, Petar Tahchiev <paranoiabla at gmail.com> wrote:
> > Hello,
> >
> > I'm really sorry to post this here but I couldn't find any jboss-logging
> > mailing list. So here's my question. I'm reading this issue:
> >
> > https://issues.jboss.org/browse/JBLOGGING-95
> >
> > and I'm trying to make my hibernate use log4j2. So far I had
> >
> > <dependency>
> >     <groupId>org.jboss.logging</groupId>
> >     <artifactId>jboss-logging-log4j</artifactId>
> >      <version>${jboss.logging.version}</version>
> > </dependency>
> >
> > and I have log4j -> log4j2 routed. Unfortunately now my hibernate
> creates a
> > log4j.log file and log4j prints the messages to the command line (still
> no
> > log4j2) :(
> >
> > So I got rid of this dependency and I added the jboss-logging. So now
> > here's my set of jars:
> >
> > hibernate-core
> > hibernate-entitymanager
> > hibernate-c3p0
> > hibernate-validator
> > log4j2
> > org.jboss.logging:jboss-logging:jar:3.2.0.Beta1
> >
> > then I run my task and I get performance of:
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] BUILD SUCCESS
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 3:12.951s
> > [INFO] Finished at: Fri Jul 11 12:50:41 EEST 2014
> > [INFO] Final Memory: 128M/508M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > 3 minutes and 12 seconds. Performance is quite good. However I use the
> > maven enforcer plugin and maven did warn me I have duplicate classes:
> >
> > Duplicate classes found:
> >
> >   Found in:
> >     org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
> >     org.jboss.logging:jboss-logging:jar:3.2.0.Beta1:compile
> >   Duplicate classes:
> >     org/jboss/logging/Field.class
> >     org/jboss/logging/LoggerProvider.class
> >     org/jboss/logging/Log4jLoggerProvider.class
> >     org/jboss/logging/NDC.class
> >     org/jboss/logging/MessageBundle.class
> >     org/jboss/logging/AbstractMdcLoggerProvider.class
> >     org/jboss/logging/Log4jLogger$1.class
> >     org/jboss/logging/Messages$1.class
> >     org/jboss/logging/JDKLevel.class
> >     org/jboss/logging/DelegatingBasicLogger.class
> >     org/jboss/logging/JDKLoggerProvider.class
> >     org/jboss/logging/Slf4jLoggerProvider.class
> >     org/jboss/logging/LoggingClass.class
> >     org/jboss/logging/Messages.class
> >     org/jboss/logging/AbstractLoggerProvider.class
> >     org/jboss/logging/Property.class
> >     org/jboss/logging/JBossLogRecord.class
> >     org/jboss/logging/SerializedLogger.class
> >     org/jboss/logging/Message.class
> >     org/jboss/logging/MDC.class
> >     org/jboss/logging/Message$Format.class
> >     org/jboss/logging/JBossLogManagerProvider$1.class
> >     org/jboss/logging/Cause.class
> >     org/jboss/logging/Param.class
> >     org/jboss/logging/JDKLogger$1.class
> >     org/jboss/logging/JBossLogManagerLogger.class
> >     org/jboss/logging/Slf4jLogger.class
> >     org/jboss/logging/JBossLogManagerProvider.class
> >     org/jboss/logging/FormatWith.class
> >     org/jboss/logging/Slf4jLocationAwareLogger$1.class
> >     org/jboss/logging/Logger$Level.class
> >     org/jboss/logging/BasicLogger.class
> >     org/jboss/logging/Logger$1.class
> >     org/jboss/logging/JDKLogger.class
> >     org/jboss/logging/JBossLogManagerLogger$1.class
> >     org/jboss/logging/MessageLogger.class
> >     org/jboss/logging/ParameterConverter.class
> >     org/jboss/logging/Logger.class
> >     org/jboss/logging/Slf4jLocationAwareLogger.class
> >     org/jboss/logging/Log4jLogger.class
> >     org/jboss/logging/LoggerProviders$1.class
> >     org/jboss/logging/Slf4jLogger$1.class
> >     org/jboss/logging/AbstractLoggerProvider$Entry.class
> >     org/jboss/logging/LogMessage.class
> >     org/jboss/logging/LoggerProviders.class
> >
> > I excluded the jboss-logging from all hibernate dependencies like this:
> >         <dependency>
> >             <groupId>org.hibernate</groupId>
> >             <artifactId>hibernate-validator</artifactId>
> >             <version>${hibernate.validator.version}</version>
> >             <exclusions>
> >                 <exclusion>
> >                     <groupId>org.jboss.logging</groupId>
> >                     <artifactId>jboss-logging</artifactId>
> >                 </exclusion>
> >             </exclusions>
> >         </dependency>
> >
> > No more duplicate classes :) . I run the same task again and here's the
> > performance:
> >
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] BUILD SUCCESS
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 1:30:04.829s
> > [INFO] Finished at: Fri Jul 11 12:28:08 EEST 2014
> > [INFO] Final Memory: 118M/512M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > 1 hour and 30 minutes and 4 seconds!!!!!! OMG :X How could this be??? And
> > on top of this no Log4j messages are coming through :(
> >
> > This is probably a bug or I'm clearly missing how to setup Hibernate and
> > LOG4J2. Can you please help me, or at least point me to a forum or
> mailing
> > list where I can post this.
> >
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> > ---
> > Public PGP Key at:
> >
> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>



-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611


More information about the hibernate-dev mailing list