-->
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.  [ 4 posts ] 
Author Message
 Post subject: JPA Hibernate not Logging with Log4j custom name xml file
PostPosted: Tue Mar 06, 2012 8:08 am 
Newbie

Joined: Tue Mar 06, 2012 7:53 am
Posts: 3
Hello, i have a problem with the hibernate logging.
I have a war with GWT and spring and a EAR with EJB3 + JPA 2 + Hibernate + Spring. Everything is deployed on WebLogic 12c
The problem is that i have to use for my application a log4j xml file that MUST be named so: flowapp-log4j-2.0.xml.
I have 4 appenders in this configuration file and it logs everything unless Hibernate, it creates the file but it doesn't write anything.

This is my configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<log4j:configuration debug="false" threshold="all"
xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="GACONSOLE_LOGGER" class="it.reply.sytel.flowapp.logging.EAIInMemoryDailyRollingFileAppender">
<param name="Append" value="true" />
<param name="ImmediateFlush" value="true" />
<param name="BufferedIO" value="false" />
<param name="BufferSize" value="4096" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="File"
value="/gs-console-shared-log/GSCONSOLE-WEB-${weblogic.Name}.$.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{dd MMM yyyy HH:mm:ss,SSS}] %-4r [%t] %-5p %c %x - %m%n" />
</layout>
</appender>
<appender name="GACONSOLE_EJB_LOGGER" class="it.reply.sytel.flowapp.logging.EAIInMemoryDailyRollingFileAppender">
<param name="Append" value="true" />
<param name="ImmediateFlush" value="true" />
<param name="BufferedIO" value="false" />
<param name="BufferSize" value="4096" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="File"
value="/gs-console-shared-log/GSCONSOLE-EJB-${weblogic.Name}.$.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{dd MMM yyyy HH:mm:ss,SSS}] %-4r [%t] %-5p %c %x - %m%n" />
</layout>
</appender>


<appender name="SPRING_LOGGER" class="it.reply.sytel.flowapp.logging.EAIInMemoryDailyRollingFileAppender">
<param name="Append" value="true" />
<param name="ImmediateFlush" value="true" />
<param name="BufferedIO" value="false" />
<param name="BufferSize" value="4096" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="File"
value="/gs-console-shared-log/GSCONSOLE-SPRING-${weblogic.Name}.$.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{dd MMM yyyy HH:mm:ss,SSS}] %-4r [%t] %-5p %c %x - %m%n" />
</layout>
</appender>

<appender name="HIBERNATE_LOGGER" class="it.reply.sytel.flowapp.logging.EAIInMemoryDailyRollingFileAppender">
<param name="Append" value="true" />
<param name="ImmediateFlush" value="true" />
<param name="BufferedIO" value="false" />
<param name="BufferSize" value="4096" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="File"
value="/gs-console-shared-log/GSCONSOLE-HIBERNATE-${weblogic.Name}.$.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{dd MMM yyyy HH:mm:ss,SSS}] %-4r [%t] %-5p %c %x - %m%n" />
</layout>
</appender>

<!-- Loggers for XAWES Multimedia Content Server -->
<logger additivity="false" name="it.reply.sytel.gs.gaconsole">
<level class="it.reply.sytel.flowapp.gs.logging.TILevel" value="INFO"/>
<appender-ref ref="GACONSOLE_LOGGER" />
</logger>

<logger additivity="false" name="it.reply.sytel.gaconsoleejb">
<level class="it.reply.sytel.flowapp.gs.logging.TILevel" value="INFO"/>
<appender-ref ref="GACONSOLE_EJB_LOGGER" />
</logger>
<logger additivity="false" name="org.springframework">
<level value="ERROR"/>
<appender-ref ref="SPRING_LOGGER" />
</logger>
<logger additivity="false" name="org.hibernate">
<level value="ERROR"/>
<appender-ref ref="HIBERNATE_LOGGER" />
</logger>

</log4j:configuration>

These are my maven dependecies on the ejb project

antlr-2.7.4.jar
commons-codec-1.4.jar
commons-collections-3.2.jar
commons-exec-1.0.1.jar
commons-io-2.0.jar
commons-lang-2.5.jar
commons-logging-1.1.jar
commons-pool-1.5.4.jar
dom4j-core-1.4-dev-8.jar
flowapp-lib-foundation-2.0.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.9.jar
hibernate-entitymanager-3.6.9.jar
hibernate-jpa-2.0-api-1.0.1.jar
javaee-api-6.0.jar
javassist-3.3.jar
jaxen-1.1.1.jar
junit-4.8.1.jar
log4j-1.2.16.jar
ojdbc6-11.2.0.1.0.jar
serializer-2.7.1.jar
slf4j-api-1.6.4.jar
slf4j-log4j12-1.6.4.jar
spring-asm-3.0.1.RELEASE.jar
spring-beans-3.0.1.RELEASE.jar
spring-context-3.0.1.RELEASE.jar
spring-core-3.0.1.RELEASE.jar
spring-dao-2.0.8.jar
spring-expression-3.0.1.RELEASE.jar
spring-jdbc-3.0.1.RELEASE.jar
spring-orm-3.0.1.RELEASE.jar
spring-tx-3.0.1.RELEASE.jar
spring-web-3.0.1.RELEASE.jar
xalan-2.7.1.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xml-resolver-1.2.jar

When i deploy the EJB Ear on Server, i can see hibernate logging on the system out of the server, but it doesn't logs on the file. Can anybody please help me? Thanks in advance! :)


Top
 Profile  
 
 Post subject: Re: JPA Hibernate not Logging with Log4j custom name xml file
PostPosted: Thu Mar 15, 2012 9:24 am 
Newbie

Joined: Tue Mar 06, 2012 7:53 am
Posts: 3
I can't solve this problem...anyone knows this solution? :)
Thanks!


Top
 Profile  
 
 Post subject: Re: JPA Hibernate not Logging with Log4j custom name xml file
PostPosted: Wed Mar 21, 2012 11:54 am 
Newbie

Joined: Wed Mar 21, 2012 11:46 am
Posts: 1
Did you try to watch the pipp-a-prop property value in the web.xml file under the WEB-INF folder?

Best Regard


Top
 Profile  
 
 Post subject: Re: JPA Hibernate not Logging with Log4j custom name xml file
PostPosted: Thu Mar 22, 2012 11:50 am 
Newbie

Joined: Tue Mar 06, 2012 7:53 am
Posts: 3
I don't think the problem is the pipp-a-property, it seems to be ok, but maybe i have to use the Kick-A-Colleague property putting the name of my stupid office colleague that answered to this post as a value :)

Anyway, after weeks, I have found the solution and I hope it can help some other people. The problem depends on the Weblogic server, because it already has the slf4j jars in the Modules directory, of another version (org.slf4j.api_1.6.1.0.jar) and uses java logging implementation (org.slf4j.jdk14_1.6.1.0.jar). So Weblogic, loads before these jars and ignore the application jars.
I solved this putting the weblogic-application.xml file into the EAR and writing this tag:

<prefer-application-packages>
<package-name>org.slf4j</package-name>
</prefer-application-packages>

so it tells to weblogic to load the application jars containing the package org.slf4j BEFORE weblogic jars into the weblogic installation.

Now everything logs fine reading my log4j xml property file.

Best regards!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.