<div dir="ltr">Hi guys,<br><br>I'm reposting this from hibernate-dev following the advice I was given there.<br>-----------------------------------------------------------------------------------------------------------<br>
So here's my question. I'm reading this issue:<div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<a href="https://issues.jboss.org/browse/JBLOGGING-95" target="_blank">https://issues.jboss.org/browse/JBLOGGING-95</a></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
and I'm trying to make my hibernate use log4j2. So far I had </div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<dependency></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<groupId>org.jboss.logging</groupId><br> <artifactId>jboss-logging-log4j</artifactId><br> <version>${jboss.logging.version}</version><br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
</dependency></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
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) :(</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
So I got rid of this dependency and I added the jboss-logging. So now here's my set of jars:</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
hibernate-core</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
hibernate-entitymanager</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
hibernate-c3p0</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
hibernate-validator</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
log4j2</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
org.jboss.logging:jboss-logging:jar:3.2.0.Beta1<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
then I run my task and I get performance of:</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>[INFO] ------------------------------------------------------------------------</div><div>[INFO] BUILD SUCCESS</div><div>[INFO] ------------------------------------------------------------------------</div><div>[INFO] Total time: 3:12.951s</div>
<div>[INFO] Finished at: Fri Jul 11 12:50:41 EEST 2014</div><div>[INFO] Final Memory: 128M/508M</div><div>[INFO] ------------------------------------------------------------------------</div></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
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:</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>Duplicate classes found:</div><div><br></div><div> Found in:</div><div> org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile</div><div> org.jboss.logging:jboss-logging:jar:3.2.0.Beta1:compile</div><div> Duplicate classes:</div>
<div> org/jboss/logging/Field.class</div><div> org/jboss/logging/LoggerProvider.class</div><div> org/jboss/logging/Log4jLoggerProvider.class</div><div> org/jboss/logging/NDC.class</div><div> org/jboss/logging/MessageBundle.class</div>
<div> org/jboss/logging/AbstractMdcLoggerProvider.class</div><div> org/jboss/logging/Log4jLogger$1.class</div><div> org/jboss/logging/Messages$1.class</div><div> org/jboss/logging/JDKLevel.class</div><div> org/jboss/logging/DelegatingBasicLogger.class</div>
<div> org/jboss/logging/JDKLoggerProvider.class</div><div> org/jboss/logging/Slf4jLoggerProvider.class</div><div> org/jboss/logging/LoggingClass.class</div><div> org/jboss/logging/Messages.class</div><div> org/jboss/logging/AbstractLoggerProvider.class</div>
<div> org/jboss/logging/Property.class</div><div> org/jboss/logging/JBossLogRecord.class</div><div> org/jboss/logging/SerializedLogger.class</div><div> org/jboss/logging/Message.class</div><div> org/jboss/logging/MDC.class</div>
<div> org/jboss/logging/Message$Format.class</div><div> org/jboss/logging/JBossLogManagerProvider$1.class</div><div> org/jboss/logging/Cause.class</div><div> org/jboss/logging/Param.class</div><div> org/jboss/logging/JDKLogger$1.class</div>
<div> org/jboss/logging/JBossLogManagerLogger.class</div><div> org/jboss/logging/Slf4jLogger.class</div><div> org/jboss/logging/JBossLogManagerProvider.class</div><div> org/jboss/logging/FormatWith.class</div>
<div> org/jboss/logging/Slf4jLocationAwareLogger$1.class</div><div> org/jboss/logging/Logger$Level.class</div><div> org/jboss/logging/BasicLogger.class</div><div> org/jboss/logging/Logger$1.class</div><div> org/jboss/logging/JDKLogger.class</div>
<div> org/jboss/logging/JBossLogManagerLogger$1.class</div><div> org/jboss/logging/MessageLogger.class</div><div> org/jboss/logging/ParameterConverter.class</div><div> org/jboss/logging/Logger.class</div><div>
org/jboss/logging/Slf4jLocationAwareLogger.class</div><div> org/jboss/logging/Log4jLogger.class</div><div> org/jboss/logging/LoggerProviders$1.class</div><div> org/jboss/logging/Slf4jLogger$1.class</div><div>
org/jboss/logging/AbstractLoggerProvider$Entry.class</div><div> org/jboss/logging/LogMessage.class</div><div> org/jboss/logging/LoggerProviders.class</div></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
I excluded the jboss-logging from all hibernate dependencies like this:</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div> <dependency></div><div> <groupId>org.hibernate</groupId></div><div> <artifactId>hibernate-validator</artifactId></div><div> <version>${hibernate.validator.version}</version></div>
<div> <exclusions></div><div> <exclusion></div><div> <groupId>org.jboss.logging</groupId></div><div> <artifactId>jboss-logging</artifactId></div>
<div> </exclusion></div><div> </exclusions></div><div> </dependency></div></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
No more duplicate classes :) . I run the same task again and here's the performance:</div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div>[INFO] ------------------------------------------------------------------------</div><div>[INFO] BUILD SUCCESS</div><div>[INFO] ------------------------------------------------------------------------</div><div>[INFO] Total time: 1:30:04.829s</div>
<div>[INFO] Finished at: Fri Jul 11 12:28:08 EEST 2014</div><div>[INFO] Final Memory: 118M/512M</div><div>[INFO] ------------------------------------------------------------------------</div></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
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 :(<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="color:rgb(34,34,34);font-family:arial;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
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.</div><div class=""><div id=":417" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"><br>---------------------------------------------------------------------------------------------------------<br>
</div></div><div><br>-- <br>Regards, Petar!<br>Karlovo, Bulgaria.<br>---<br>Public PGP Key at: <a href="https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611" target="_blank">https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611</a><br>
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF 55A5 1965 8550 C311 0611
</div></div>