logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BLa...@flsg.follett.com
Subject RE: Problem using XML config file
Date Tue, 15 Jan 2002 23:04:39 GMT

You need single quotes around the rest of your values in your sql.

I'd try replacing your sql in your xml with this:

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

- Bob




                                                                                         
                    
                    Sara Prigge                                                          
                    
                    <sprigge@LTCG        To:     "'Log4J Users List'" <log4j-user@jakarta.apache.org>
        
                    .com>                cc:                                          
                       
                                         Subject:     RE: Problem using XML config file  
                    
                    01/15/2002                                                           
                    
                    03:51 PM                                                             
                    
                    Please                                                               
                    
                    respond to                                                           
                    
                    "Log4J Users                                                         
                    
                    List"                                                                
                    
                                                                                         
                    
                                                                                         
                    




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
>






--
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