title: Configuring log4j property file to store in mysql Database
body: <p>It's been a while that I began with log4j; pretty cool logging framework. I've done other type of logging like Console and File Logging. So trying for DB Adapters with mysql for Database logging. Accordingly, I've created following property file named log4j.properties as -</p>
  
  <pre><code># Define the root logger with appender file
  log4j.rootLogger = DEBUG, DB
  
  # Define the DB appender
  log4j.appender.DB=org.apache.log4j.jdbc.JDBCAppender
  
  # Set JDBC URL
  log4j.appender.DB.URL=jdbc:mysql://localhost:3306/test
  
  # Set Database Driver
  log4j.appender.DB.driver=com.mysql.jdbc.Driver
  
  # Set database user name and password
  log4j.appender.DB.user=root
  log4j.appender.DB.password=
  
  # Set the SQL statement to be executed.
  log4j.appender.DB.sql=insert into log(date,level,message) values("%d","%p","%m")
  
  # Define the layout for file appender
  log4j.appender.DB.layout=org.apache.log4j.PatternLayout
  </code></pre>
  
  <p>And used it in a test class in following way - </p>
  
  <pre><code> public class DBLoggerTest {
      static Logger logger;
  
      public DBLoggerTest() {
          //System.setProperty("log4j.configuration", "log4j.properties");
          logger = Logger.getLogger(DBLoggerTest.class.getName());
  
      }
  
      public static void main(String[] args) {
          new DBLoggerTest();
          logger.info("This is a test info");
          logger.error("This is an error messsage");
      }
  }
  </code></pre>
  
  <p>But I got following error - </p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (com.satyam.logger.test.DBLoggerTest).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  </code></pre>
  
  <p>Any help please...?</p>