You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by suneelreddy yaramaka <su...@gmail.com> on 2006/08/02 18:57:23 UTC

data not inserting in to logging_event_exception....Log4j

 Hi

Iam working on log4j…

My log messages *data not inserting in database, Logging_event_exception
table…*

*We r using jdbc3.0.*

Iam struggling witht his problem…

I wrote my log4j.xml in this way….



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

<appender name="A1"  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="jdbc:mysql://192.168.1.225:3306/smartedb?autoReconnect=true" />

</connectionSource>

<param name="LocationInfo" value ="true" />

</appender>

<root>

    <level value="info"/>

    <appender-ref ref="A1"/>

</root>

</log4j:configuration>



For that what can I do…..



This is my class…



package Smarte;

import java.io.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

import org.apache.log4j.*;

import org.apache.log4j.spi.LoggingEvent;

import org.apache.log4j.MDC;

import org.apache.log4j.AppenderSkeleton;



public class SmarteLog extends HttpServlet {



   static Logger log = Logger.getLogger("Smarte.SmarteLog");

static

{

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

}

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

             MDC.put("smarte",req.getRemoteAddr());

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

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

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

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

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



                                    res.setContentType("text/plain");

                                    PrintWriter out = res.getWriter();



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

  }





}



Plz stuffer I want to insert the data in to logging_event_exception…

Iam waiting for ur reply…

Plz help me…

Thanks & Rgds,



Suneel