Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j JDBCAppender

 
Lalit mishra
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I am new to Log4j can any one send me a sample code for JdbcAppender
I will be really greatful

Thanks
Lalit
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if these help:

Log4j JDBCAppender

JDBCAppender Example
 
Yeshokiran Nrusimhadevara
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:See if these help:

Log4j JDBCAppender

JDBCAppender Example


Hi I have used the following set of statements. However this doesnot execute the sql and DB insertions are not successful.
JDBCAppender jDBCAppender = new JDBCAppender();
jDBCAppender.setDriver("oracle.jdbc.driver.OracleDriver");
jDBCAppender.setURL("jdbcracle:thin:@I.P:instance");

jDBCAppender.setUser("username");

jDBCAppender.setPassword("pwd");

jDBCAppender.setSql(sql);

logger.addAppender(jDBCAppender);

jDBCAppender.close();


Please suggest if there are any additions required to the above set.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

Can you please ask your question in a new thread and post the exact contents of your configuration file please
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic