Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

log 4j JDBC APPENDER PROPERTY FILE DOUBT???

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • 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
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(L)
values ('%m')

Shouldn't that all be on one line?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!