Hi

This is suneel

Iam facing problems with DBAppender configuration.

We r using Log4j-1.3alpha-8..MySQL.

What is dialect I don't know my Jdbc supports that one.

How can I solve it.

Actually what is the process..

Just I wrote a class like.

 

package Smarte;

import java.io.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

import org.apache.log4j.*;

 

 

public class Smartelog {

static Logger logger = Logger.getLogger("Smarte.Smartelog");

static

{

org.apache.log4j.BasicConfigurator.configure();

}

 public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {

                 

                    logger.debug("This is my debug message.");

                    logger.info("This is my info message.");

                    logger.warn("This is my warn message.");

                    logger.error("This is my error message.");

                    logger.fatal("This is my fatal message.");

                    

                        res.setContentType("text/plain");

                                    PrintWriter out = res.getWriter();

                                    out.println(" TEST = " + new
Date().toString());

  }

 

}

Iam applying DBAppender for this..

 

And I set  the jdbc driver in my classpath like this.

C:\Program
Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\common\lib\mysql-connect
or-java-3.1.12-bin.jar;

 

I wrote log4j.xml like this.

 

 

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

    <appender  name="DB" class="org.apache.log4j.db.DBAppender"> 

        <connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource"> 

            <param name="driverClass" value="com.mysql.jdbc.Driver" /> 

            <param name="url" value="MyURL" /> 

            <param name="user" value="smarte2"/>

            <param name="Password" value="smarte911"/>

         </connectionSource> 

    </appender>

</log4j:configuration>

 

It shows some thing like.

 

log4j:INFO Using URL [file:/C:/Program
Files/netbeans-4.1/enterprise1/jakarta-tomcat-5.5.7/common/classes/log4j.xml
] for automatic log4j configuration of repository named [default].

LOG4J-INTERNAL: 2006-07-27 13:05:41,515 DEBUG [main]
org.apache.log4j.joran.action.ConfigurationAction#begin:42)- Starting
internal logs on console.

LOG4J-INTERNAL: 2006-07-27 13:05:41,547 DEBUG [main]
org.apache.log4j.joran.action.AppenderAction#begin:52)- About to instantiate
appender of type [org.apache.log4j.db.DBAppender]

LOG4J-INTERNAL: 2006-07-27 13:05:41,593 DEBUG [main]
org.apache.log4j.joran.action.AppenderAction#begin:67)- Appender named as
[DB]

LOG4J-INTERNAL: 2006-07-27 13:05:41,593 DEBUG [main]
org.apache.log4j.joran.action.AppenderAction#begin:78)- Pushing appender on
to the object stack.

LOG4J-INTERNAL: 2006-07-27 13:05:41,672 DEBUG [main]
org.apache.log4j.joran.action.ParamAction#begin:61)- In ParamAction setting
parameter [driverClass] to value [com.mysql.jdbc.Driver].

LOG4J-INTERNAL: 2006-07-27 13:05:41,687 DEBUG [main]
org.apache.log4j.joran.action.ParamAction#begin:61)- In ParamAction setting
parameter [url] to value [jdbc:mysql://192.168.1.225:3306/smartedb].

LOG4J-INTERNAL: 2006-07-27 13:05:41,687 DEBUG [main]
org.apache.log4j.joran.action.ParamAction#begin:61)- In ParamAction setting
parameter [user] to value [smarte2].

LOG4J-INTERNAL: 2006-07-27 13:05:41,734 DEBUG [main]
org.apache.log4j.joran.action.ParamAction#begin:61)- In ParamAction setting
parameter [Password] to value [smarte911].

LOG4J-INTERNAL: 2006-07-27 13:05:42,890 DEBUG [main]
org.apache.log4j.db.DBAppender#setConnectionSource:199)- setConnectionSource
called for DBAppender

LOG4J-INTERNAL: 2006-07-27 13:05:42,890 DEBUG [main]
org.apache.log4j.db.DBAppender#activateOptions:164)-
DBAppender.activateOptions called

LOG4J-INTERNAL: 2006-07-27 13:05:42,890 DEBUG [main]
org.apache.log4j.joran.action.AppenderAction#end:110)- Popping appender
named [DB] from the object stack

LOG4J-INTERNAL: 2006-07-27 13:05:42,890 DEBUG [main]
org.apache.log4j.joran.action.ConfigurationAction#end:49)- Will stop writing
internal logs on console.

 

After it shows Failed to start server bundled Tomacat(5.5.7)

 

 

What id the dialect.how can I write it in MySQL.

Plz send me any piece of code or steps how to configure Log4j with
DBAppender..

 

 

Thanks & Rgds,

 

Yaramaka SuneelReddy.

Software Engineer,

Smarte Solutions,

ph : + 91 9833022044

 

 

Reply via email to