[wildfly-dev] Hibernate + Log4J2 Performance Problem
James R. Perkins
jperkins at redhat.com
Mon Jul 14 11:29:47 EDT 2014
This would probably a better conversion on the forum,
https://community.jboss.org/en/wildfly/content. WildFly does not
currently provide log4j2 and no longer uses jboss-logging-log4j.
On 07/11/2014 07:32 AM, Petar Tahchiev wrote:
> Hi guys,
>
> I'm reposting this from hibernate-dev following the advice I was given
> there.
> -----------------------------------------------------------------------------------------------------------
> 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
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
--
James R. Perkins
JBoss by Red Hat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140714/492f4944/attachment-0001.html
More information about the wildfly-dev
mailing list