File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes ms sql with log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ms sql with log4j" Watch "ms sql with log4j" New topic

ms sql with log4j

cc sekhar

Joined: Feb 06, 2004
Posts: 2
#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.URL=jdbc dbc:emp
log4j.appender.R.sql=INSERT INTO testme VALUES (10,'madu')
# These definea the layout to be used.
#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[]) {
logger.debug("Here is some DEBUG");"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
I agree. Here's the link:
subject: ms sql with log4j
It's not a secret anymore!