-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate/log4j: WARN No appenders could be found
PostPosted: Tue Aug 31, 2004 1:20 am 
Newbie

Joined: Mon Aug 30, 2004 6:25 am
Posts: 7
Hibernate version: 2.1

I have this project file tree:

Code:
/
  /bin
    HTest.class
    ...
  /src
    HTest.java
    ...
  /lib
    hibernate2.jar
    log4j.jar
    ...
  build.xml
  hibernate.properties
  log4j.properties
  ...


On run I get:

Code:
log4j:WARN No appenders could be found for logger (net.sf.hibernate.util.DTDEntityResolver).
log4j:WARN Please initialize the log4j system properly.


If I move log4j.properties to bin directory all works fine. How can I run project with log4j.properties in / ?

hibernate.properties:

Code:
hibernate.dialect net.sf.hibernate.dialect.FirebirdDialect
hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
hibernate.connection.url jdbc:firebirdsql:192.168.46.1:test
hibernate.connection.username sysdba
hibernate.connection.password ats45system
hibernate.hbm2ddl.auto create
hibernate.show_sql true


build.xml:

Code:
<?xml version="1.0"?>
<project name="HTest" basedir="." default="run">
    <property name="build.src" value="src"/>
    <property name="build.destdir" value="bin"/>
    <path id="project.class.path">
        <pathelement path="bin"/>       
        <fileset dir="lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    <fileset id="hibernate.mapping.files" dir="${build.src}">
        <include name="**/*.hbm.xml" />
    </fileset>
    <target name="gen-classes" description="Creates the code based on the Hibernate mapping docs.">
        <pathconvert refid="hibernate.mapping.files" property="hibernate.mappings" pathsep=" "/>
   <java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator" fork="true">
       <classpath refid="project.class.path" />
       <arg line="--output=${build.src}"/>
       <arg line="${hibernate.mappings}"/>
   </java>
    </target>
    <target name="compile" depends="gen-classes" description="Compiles source.">
        <mkdir dir="${build.destdir}"/>
   <javac srcdir="${build.src}" destdir="${build.destdir}" debug="true" classpathref="project.class.path"/>
        <copy todir="${build.destdir}" >
            <fileset dir="${build.src}" >
                <include name="**/*.hbm.xml"/>
               <include name="**/*.sql"/>
            </fileset>
        </copy>
    </target>
    <target name="run" depends="compile">
        <java classname="HTest" fork="true">
            <classpath refid="project.class.path" />
        </java>
    </target>
</project>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 4:29 am 
Newbie

Joined: Mon Aug 30, 2004 11:43 am
Posts: 3
Hello,

You need tu put your log4j.properties in the root of your classpath... you can change the classhpath to point where you need.

Code:
.6. Logging

Hibernate logs various events using Apache commons-logging.

The commons-logging service will direct output to either Apache Log4j (if you include log4j.jar in your classpath) or JDK1.4 logging (if running under JDK1.4 or above). You may download Log4j from http://jakarta.apache.org. To use Log4j you will need to place a log4j.properties file in your classpath, an example properties file is distributed with Hibernate in the src/ directory.


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