This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

ms sql with log4j

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#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
 
What are your superhero powers? Go ahead and try them on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!