Forums Register Login

ms sql with log4j

+Pie Number of slices to send: Send
#this is my kk.xml file

# This defines the logging level for the rootLogger. It is not required
# if you are going to keep the level at debug as the rootLogger by default
# is at the debug level. The value after the comma is the appender for the
# root and we have given it the name R
#
log4j.rootLogger=debug, R
#
# Since we plan to log to a database, we tell log4j that we will use the
# JDBCAppender. To complete the configuration for this, we need to tell
# some basic things to this appender. Database, Username, password and the
# actual values to log. %m represents the message that will be generated by
# our log statements.
#
log4j.appender.R=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.R.Driver=sun.jdbc.odbc.JdbcOdbcDriver
log4j.appender.R.URL=jdbc dbc:emp
log4j.appender.R.user=sa
log4j.appender.R.password=
log4j.appender.R.sql=INSERT INTO testme VALUES (10,'madu')
#
# These definea the layout to be used.
#
log4j.appender.R.layout=org.apache.log4j.PatternLayout
#this is my log4j java file

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
public class externalplaintest {
static Logger logger = Logger.getLogger(externalplaintest.class);
public static void main(String args[]) {
PropertyConfigurator.configure("kk.xml");
logger.debug("Here is some DEBUG");
logger.info("Here is some INFO");
logger.warn("Here is some WARN");
logger.error("Here is some ERROR");
logger.fatal("Here is some FATAL");
}
}

while i am running the above code i am getting the problem
log4j:error could not instantiate the appender named jdbc2.
if i use jdbc2 instead of R(root).i am getting some other exception.
i am new to log4j.
so any one could help me to solve this problem
ok
cc
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1380 times.
Similar Threads
Why do we need mulitple loggers? - Log4j
Log4j Error
Need help with log4j logging tool to log into database
Help! I am getting strange and unusual Eclipse Warnings
Log4j and WSAD 5.0
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:12:16.