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@example.com: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....
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 testjsp. 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.
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)
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?
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 firstname.lastname@example.org thnx Rahul N B