Bookmark Topic Watch Topic
  • New Topic

log 4j JDBC APPENDER

 
Ashok George
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • 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=jdbcdbc: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
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic