permaculture playing cards*
The moose likes Object Relational Mapping and the fly likes Solution to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Solution to "log4j:WARN No appenders could be found for logger"" Watch "Solution to "log4j:WARN No appenders could be found for logger"" New topic
Author

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

Pierre Sugar
Ranch Hand

Joined: Dec 08, 2002
Posts: 62

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
Pierre Sugar
Ranch Hand

Joined: Dec 08, 2002
Posts: 62

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

Joined: Dec 08, 2002
Posts: 62

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
 
subject: Solution to "log4j:WARN No appenders could be found for logger"
 
Similar Threads
may be some bugs inside schemaexport ?
Why does reference refid="foo" torefid="bar" fails within an ant task?
persistent class not found
MiddleGen : generate schema with hbm file
Where is documentation for ant task schemaexport