• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

problem in using log4j JDBCAppender

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
i have placed the classes111 and classes12.jar files in web-inf/lib folder and used a servlet which reads this properties file and log the statement to database.i am not able to log the statements in to the database ....i have use the following properties file:
log4j.appender.R=org.apache.log4j.jdbc.JDBCAppender
log4j.rootLogger=debug, R
log4j.appender.R.Driver=oracle.jdbc.driver.OracleDriver
log4j.appender.R.URL = jdbc racle:[email protected]:1521:itsr
log4j.appender.R.user=hpabopa1
log4j.appender.R.password=hpa
log4j.appender.R.sql=INSERT INTO jdbctest(message) VALUES ('%d - %c - %p - %m')
#
# These defines the layout to be used.
#
log4j.appender.R.layout=org.apache.log4j.PatternLayout
can anyonle please help me....

thanks in advance..
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Other Open Source Projects forum.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the error / you dont see anything at all?.
log4j.properties is located in the web-inf/classes folder?
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why dont u write a simple test.jsp that retreives the logger and just
prints something to the table.
Yes log4j.jar and classes12.zip s'd be in web-inf/lib folder
Put log4j.properties in web-inf/classes folder.
Just invoke the test jsp.
If you are using tomcat and if something is wrong you s'd see an error displayed on tomcat console.
We might be able to help after taking a look at the error.
 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying the same thing, here is what I have thus far, the code, exceptions, etc.
Using: Tomcat: v4.1.29; log4j v1.2.7
log4j.properties

I get the collowing exception when Tomcat starts up:
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Yutzy:
I'm trying the same thing, here is what I have thus far, the code, exceptions, etc.


And you have the jar file that contains the driver class in web-inf/lib folder?
I guess you must be having log4j.jar there alogn with other required libraries. (I dont know the SQL Server database driver name)
 
David Yutzy
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I can use SQL Server in the web application just fine.
One thing I notice is that it appears to be loading the log4j settings during the Tomcat start-up rather than the WebApp start-up process.
When I set Log4J to debug to the console, I usually get the Tomcat stuff scroll by, then it loads the webapp stuff, showing it in debug mode.
When I change it to the DB version of log4j.properties, I see about 3 lines of Tomcat, then the exception I previously posted, then it loads the webapp.
I wonder if I placed the DB .jar driver files in the Tomcat/lib if that would make a difference?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
i m tryng to use log4j to insert the data into database. i want to insert the SQLs into the database so that we can check them in case of any error. can anyone pl. tell me how to go about it. i m new to log4j, so need help.
pl. mail me at [email protected]
thnx
Rahul N B
reply
    Bookmark Topic Watch Topic
  • New Topic