logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sara Prigge <spri...@LTCG.com>
Subject RE: Problem using XML config file
Date Tue, 15 Jan 2002 22:01:16 GMT
Forget it! I found what my problem was: I didn't have single quotes around
my SQL statement values in my XML file:

Here's what I had:

<param name="sql" value="insert into JDBCAppenderTest (message, class,
priority, logdate) values ('%m', (%c), %p, %d{ISO8601})"/>

Here's what I need:

<param name="sql" value="insert into JDBCAppenderTest (message, class,
priority, logdate) values ('%m', '(%c)', '%p', '%d{ISO8601})'"/>

Thanks everyone!


-----Original Message-----
From: Sara Prigge 
Sent: Tuesday, January 15, 2002 3:52 PM
To: 'Log4J Users List'
Subject: RE: Problem using XML config file


Thanks - there were a few other minor syntax problems.  I fixed those.  Now,
I'm getting another strange error.

I have the following method (in a class called Logging):

public void doPreLog(int level, String msg, String classname) throws
LogException {
        DOMConfigurator.configure("logging.xml");
        Category log = Category.getInstance(classname);
        try {
          doLog(log, level, msg);
        } catch (Exception e) {
            throw new LogException("Logging failed", e);
          }
}

I call this method in another class (called "test") as follows (using a
Logging object called logger):

logger.doPreLog(2, strLogMsg, this.getClass().getName());

However, I am getting the following error:

log4j:ERROR Failed to excute sql 
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]The
name 'test' is not permitted in this context. Only constants, expressions,
or variables allowed here. Column names are not permitted.

I am thinking this is a problem with my XML definition of a JDBC Appender???
I don't know why it would complain about my classname ('test').  I only use
the classname to create the Category object.  It has nothing to do with the
database items.  A regular text config file worked fine with a JDBC
Appender.  I just changed the format to XML for the XML config file.

Again - here's the relevant portion of the XML config file:

<appender name="jdbc" class="org.apache.log4j.varia.JDBCAppender">
		<param name="URL" value="jdbc:odbc:log_testing"/>
		<param name="user" value=""/>
		<param name="password" value=""/>
		<param name="driver" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
		<param name="sql" value="insert into JDBCAppenderTest
(message, class, priority, logdate) values ('%m', (%c), %p, %d{ISO8601})"/>
		<param name="threshold" value="WARN"/>
	</appender>



-----Original Message-----
From: Klaus Mueller [mailto:k.mueller@intershop.de]
Sent: Tuesday, January 15, 2002 12:40 PM
To: 'Log4J Users List'
Subject: RE: Problem using XML config file


Hi,

this line contains to much spaces:

<log4j:configuration xmlns: log4j="http://jakarta.apache.org/log4j/">

Should look like:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

But there can be more problems I do not see.

Bye
Klaus

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message