Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

log 4j JDBC APPENDER

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
log4j.properties
------------
# config file for JDBCAppender:
log4j.rootCategory=ALL, jdbc

# JDBCAppender writes messages into the database
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender

#SQL statement to be used (with multiple columns formated)
log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(L)
values ('%m')

# DB Options
log4j.appender.jdbc.URL=jdbc dbc:myDB
log4j.appender.jdbc.user=me
log4j.appender.jdbc.password=password

#set the buffer size
log4j.appender.JDBC.buffersize=1

--------------------------------------------
test.java
import org.apache.log4j.*;
import java.sql.*;
import java.lang.*;
import java.util.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.jdbcplus.JDBCAppender;

public class log4jTest
{

static Logger logger = Logger.getLogger(log4jTest.class);//new

public static void main(String[] args)
{
// Ensure to have all necessary drivers installed !
try
{
Driver d = (Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
DriverManager.registerDriver(d);
}
catch(Exception e){}


logger.setLevel(Level.DEBUG);

// Configuration with configuration-file
PropertyConfigurator.configure("log4j.properties");

logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");

}
}
---------------------------------------


here when i run the FILE. IT SAYS THE POPERTY FILE IS NOT CONFIGURED PROPERLY!!
CAN ANY 1 HELP ME PLEASEEEEEEE
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.

Thanks,
Dave
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic