File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Solution to "log4j:WARN No appenders could be found for logger"

 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
when running the SchemaExportTask or the Hbm2JavaTask everything works as it should but I get this warning.
Yes I know I have to put the log4j.properties into the classpath than it works fine. That is what I did but it doesn't work. I searched the internet if anybody had the solution to this issue. I found the issue at Subject: Hibernate & Log4j but not the solution.

Now I'm here and hoping anybody can advice. Here are some details.

Classpath definition for Hibernate's SchemaExportTask:


The schema target:


The hibernate-schema.xml file:


Thanks a lot.
Pierre

P.S. I'm using Linux, Java 1.5, ANT 1.6.2

[ August 29, 2005: Message edited by: Pierre Sugar ]
[ August 31, 2005: Message edited by: Pierre Sugar ]
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe somebody will be encountered to same issue here is a possible solution.

Though build.xml of my project has log4j.jar that ships with Hibernate in the classpath, SchemaExportTask and Hbm2JavaTask both use log4j.jar from the ANT distribution (for whatever reason).

As nothing helped I changed that, so that log4j.jar from the hibernate distribution is used. And it actually worked.

Then I checked the log4j.jar that came with ANT and the one which came with Hibernate. First they are different in size. The one with ANT is 339.5kB and the one with Hibernate is 344.4kB.
Then I looked at the manifests and found out that ANT's log4j.jar was created by Java 1.4.2_05-b04 and Hibernate's by ANT 1.5.1 (I don't know which Java version is used with ANT 1.5.1), even though Hibernate 2.1.8 ships with ANT 1.5.3. Listings below show the differences in bold.

Manifest from log4j.jar V1.2.8 from ANT V1.6.2 distribution


Manifest from log4j.jar V1.2.8 from Hibernate V2.1.8 distribution
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to say sorry. I made a mistake that's why it worked. I didn't link to any log4j-1.2.8.jar and so Hibernate couldn't find log4j and therefore used the Java logging mechanism, with which it worked.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic