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:odbc: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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Ashok,

Please do not cross post threads in multiple forums. See here for an explination as to why.

All discussion to the log4j issue can be continued in the other thread found here.

Thanks.
 
Honk if you love justice! And honk twice for tiny ads!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic