Log4j problem

I am not able to store the log data into database after using JDBCAppender of log4j. I am getting the output in file but not in database. Following errors occurred while the execution of java code : -
log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql
Handler !
log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql
Handler !
2007-03-27 18:50:18,642 [main] ERROR Log4jDemo - This is my error message.
log4j:ERROR JDBCAppender::configure()
java.lang.Exception: JDBCAppender::connect(), java.lang.InstantiationException:
org.apache.log4j.jdbcplus.JDBCConnectionHandler
at org.apache.log4j.jdbcplus.JDBCAppender.connect(JDBCAppender.java:981)
at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:99
9)
at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:921)
at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:843)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
(AppenderAttachableImpl.java:65)
at org.apache.log4j.Category.callAppenders(Category.java:203)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.error(Category.java:302)
at Log4jDemo.main(Log4jDemo.java:13)
log4j:ERROR JDBCAppender::append(), Not ready to append !
2007-03-27 18:50:18,672 [main] FATAL Log4jDemo - This is my fatal message.
log4j:ERROR JDBCAppender::configure()
java.lang.Exception: JDBCAppender::connect(), java.lang.InstantiationException:
org.apache.log4j.jdbcplus.JDBCConnectionHandler
at org.apache.log4j.jdbcplus.JDBCAppender.connect(JDBCAppender.java:981)
at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:99
9)
at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:921)
at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:843)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
(AppenderAttachableImpl.java:65)
at org.apache.log4j.Category.callAppenders(Category.java:203)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.fatal(Category.java:362)
at Log4jDemo.main(Log4jDemo.java:14)
log4j:ERROR JDBCAppender::append(), Not ready to append !

Check out how our WLS 8.1 sample application MedRec (which implements
Struts) configures Log4j.
"anand raman" <[email protected]> wrote in message
news:[email protected]..
the answer lies in log4j configuration
http://jakarta.apache.org/log4j/docs/FAQ.html#configureandwatch
Hope this helps
anand
"Eje Thorarinsson" <[email protected]> wrote in message
news:<[email protected]>...
Eh.....a clarification:
- The Log4 version is of course 1.2.8 (DOH!)
/Eje :)
"Eje Thorarinsson" <[email protected]> wrote:
Hi!
Wonder if anyone can help me out with a problem with Log4J and WebLogic
7.
We've written an application that uses WLS and a whole bunch of open
source stuff,
such as Struts 1.1RC1. We use Log4J 1.5.3 for logging. The
log4j.properties
file
is located in a config-directory, so we should be able to changelogging
parameters
on the fly. However, the application always loggs as INFO even if Ichange
to
DEBUG mode, so it doesn't seem that the properties file is beingacknowledged
at all.
I've tried using the set the JAVA_OPTIONS to:JAVA_OPTIONS=-Dlog4j.properties=file:/%REFAPP_HOME%/conf/app/log4j.propertie
s
>>>
and using the PRE_CLASSPATH with the same path (excluding the file:/
of course).
I've also tried copying the properties file to my domain, but no go.
What could
be wrong? Any help would be greatly appreciated!
Regards,
/Eje

Similar Messages

  • Log4j problem with JRockit

    When I use JRockit 8.1 SP2 with Log4j 1.2.8, it appears that JRockit handles reflection differently than the Sun JVM, because the log4j messages come back wrong under JRockit and work fine with Hotspot.
    I think if you do the following you will reproduce the issue:
    Set your ConversionPattern layout in Log4j to include Method lookup (%M) - for example:
    log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss.SSS}] %5p %x %c.%M() line %L - %m%nGet some code to log a log4j message. Run it under the different JVMs and the log4j messages will give you different results.
    For example, under Sun's JVM, the method name is properly returned in the log message:
    [15:39:21.549] DEBUG  COMMON.com.mycompany.common.security.ldap.LdapManager.findGroupsSelectedAttributes() line 696 - <exit
    [15:39:21.948]  WARN  COMMON.com.mycompany.common.dao.DAOFactory.reset() line 244 - Resetting DAO cacheUnder JRockit, you get what appears to be the return type of the method. Sometimes it's instead of the method name, sometimes it's in addition to it:
    [16:12:45.014] DEBUG  COMMON.com.mycompany.common.security.ldap.LdapManager.List;() line 696 - <exit
    [16:12:45.034]  WARN  COMMON.com.mycompany.common.dao.DAOFactory.reset()V() line 244 - Resetting DAO cache

    We have seen this problem with JRockit before and it seems to be a compatability issue with log4j.
    Quoting Jim Brown of BEA:
    "The underlying problem appears to be that log4j is ignorant of the extended method argument and type data returned by JRockit."
    At this point, we have not changed anything in JRockit to avoid this.
    Kind regards, Cecilia Borg
    BEA WebLogic JRockit

  • Log4j problem occuring through use of MDC.

    Hey folks,
    I've encountered a bit of a problem with using log4j's MDC class within applications in weblogic. It's not a bug at all it's just giving me grief.
    Basically I've setup ApplicationLifecycleListener on my ear app and on all web apps within weblogic. They're there to catch startup events so that I can slot the application name into the MDC in order to be able to retrieve it when an exception occurs.
    Web :-
    MDC.put("APPLICATION_NAME", ce.getServletContext().getServletContextName());
    EJB :-
    MDC.put("APPLICATION_NAME", evt.getApplicationContext().getApplicationName();
    Alas as the lifecycle listener events are handled on a seperate thread where exceptions occur the MDC, being effectively a threadlocal hashmap, returns null when I attempt to retrieve the name of the app.
    I was wondering if anyone could think of a cleaner way of doing this? Perhaps using JMX or even by binding the contextClassLoader (which seems to remain the same across the threads into the JNDI tree with the application name)? Or else if anyone can think of any neater way of doing this that would be great.
    Thanks,
    Mark.

    Please perform the following steps..
    In the Web Dynpro Explorer of the Web Dynpro perspective expand your Web Dynpro project
      •&#61472;Expand the nodes DC Meta Data – DC Definition and right click on “Used DCs”
      •&#61472;Choose “Add used DC”
    Find the Web Dynpro project of the CAF DC
      •&#61472;Locate and select the public part with the model in the Web Dynpro project at DC metadata- Public Parts – package_tree – Entities
      •&#61472;Choose Dependency Type “Build Time”
      •&#61472;Press “Finish”
    •&#61472;Then add the following public parts:
    o public part
    types_compilation of DC caf/core/dict (CAF compartment)
    o public part
    com.sap.caf.ui.utils of DC caf/UI/ptn/common (CAF compartment)
    o public part default of DC tc/col/runtime (compartment SAP_JTECHS)
    Please also refer to this link for overalll help on this link.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8b7059da-0c01-0010-e09c-9ecabaf58864">Using a Composite Application via a Web Dynpro UI</a>

  • Log4j problem -creating directory

    My Log4j.properties is as follows:
    log4j.rootLogger=info,stdout, R
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n
    log4j.logger.org.apache.commons=INFO
    log4j.logger.org.apache.struts=INFO
    log4j.logger.org.hibernate=INFO
    log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.R.File=../CustomeLog/myLog
    log4j.appender.R.datePattern='_'MM-dd-yyyy'.txt'
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    CustomLog folder does not exist in tomcat home directory.. i want it to be created automatically. i have written servlet for that. but problem is that servlet is read after log4.properties.. so tomcat gives me error fileNotFound as it cannot get CustomLog folder..
    can anybody help me on this issue?? My aim is that whenever tomcat starts, customLogs folder shud be created if it doesnot exists.. log4j takes the care of the rest..

    See if this forum thread helps:
    http://forums.sun.com/thread.jspa?threadID=5193205

  • Dummy://log4j.dtd (log4j problem in Oracle 10gAS)

    Hi,
    Wonder who has log4j.xml experience in EJB environment?
    I tried on Oracle 10gAS on Windows (the iAS version actually is still 9.0.4.2), my log4j initilization code looks like:
    InputStream inStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(sLogFileName);
    new DOMConfigurator().doConfigure(inStream, LogManager.getLoggerRepository());
    There is no problem to find the log4j.xml however the application server complains the log4j.dtd:
    04/10/08 18:48:18 Start process
    04/10/08 18:48:33 Oracle Application Server Containers for J2EE 10g (9.0.4.0.0) initialized
    04/10/08 18:49:09 log4j:ERROR Parsing error on line 0 and column 0
    04/10/08 18:49:09 log4j:ERROR File "dummy://log4j.dtd" not found.
    04/10/08 18:49:09 log4j:ERROR Could not parse input source [org.xml.sax.InputSource@177fa9a].
    04/10/08 18:49:09 org.xml.sax.SAXException: Stopping after fatal error: File "dummy://log4j.dtd" not found.
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1245)
    04/10/08 18:49:09 at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:501)
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
    04/10/08 18:49:09 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
    04/10/08 18:49:09 at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
    04/10/08 18:49:09 at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
    I check DOMConfiguration.java, it contains:
    docBuilder.setErrorHandler(new SAXErrorHandler());
    docBuilder.setEntityResolver(new Log4jEntityResolver());
    // we change the system ID to a valid URI so that Crimson won't
    // complain. Indeed, "log4j.dtd" alone is not a valid URI which
    // causes Crimson to barf. The Log4jEntityResolver only cares
    // about the "log4j.dtd" ending.
    inputSource.setSystemId("dummy://log4j.dtd");
    Document doc = docBuilder.parse(inputSource);
    parse(doc.getDocumentElement());
    Anybody has an idea and help me? Thanks in advance.

    Abirami,
    This problem got solved as the static variables used for the JDBCAppender class are case sensitive.
    I modifed the variables Driver and URL. Now it is working for me.
    Here is the corrected code:
    log4j.appender.db=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.db.Driver=oracle.jdbc.driver.OracleDriver
    log4j.appender.db.URL=jdbc racle:thin:server:1523 bname
    log4j.appender.db.user=username
    log4j.appender.db.password=password
    log4j.appender.db.sql=INSERT INTO LOG VALUES ('%d %-5p -%F %m')
    log4j.appender.db.layout=org.apache.log4j.PatternLayout
    log4j.appender.db.layout.ConversionPattern=%d %-5p - %m
    log4j.appender.db.Threshold=debug

  • 9.0.3 and Log4J problem

    Hi - running 9.0.3 with WebCache and HttpServer on Windows2000.
    If I add the Log4J-1.2.8.jar file to my /lib directory to use log4j, I cannot get the Enterprise Manager Console running. This is the error:
    500 Internal Server Error
    java.lang.NoClassDefFoundError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:190)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.loadServlet(HttpApplication.java:1890)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.findServlet(HttpApplication.java:4355)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2484)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:617)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)
    The NT processes in the Control panel/services are all running, WebCache administrator on port 4000 is running fine, the container accepts requests and the app seems to be fine.
    Anyody experience problems with Log4J so far?
    Tks
    Andre

    Found bug on Metalink with a resolution...
    Tks
    Put the new log4j.jar file in completely new location and modify application.xml for your OC4J instance to include the new log4j.jar using: <library path="/private/ias/ora9ias/mylog4j/lib" /> ---Use this if the same log4j.jar is being used by more than one application

  • JBoss Log4J problem

    Hi all,
    Although Log4J is not exactly about Java, but it is kind of related, so please don't mind me posting this message.
    I am having problems stoping JBoss from reloading the log4j.properties file. Is there anyway to stop it from polling the log4j.properties file every now and then..
    Thx for your help
    Kevin

    Look at ${JBOSS_HOME}/server/default/jboss-service.xml. It has a section with the following code:
       <mbean code="org.jboss.logging.Log4jService"
          name="jboss.system:type=Log4jService,service=Logging">
          <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
          <attribute name="Log4jQuietMode">true</attribute>
          <!-- How frequently in seconds the ConfigurationURL is checked for changes -->
          <attribute name="RefreshPeriod">60</attribute>
       </mbean>You could try setting the refresh periode to 0, but I don't know to what kind of behaviour that will result in.

  • Log4j problem; please help

    Hi, I am new to Log4j and i have a question.
    I have an WAR file that contains a log4j proerpties file.
    <myapp.war>/WEB-INF/classes/log4j.properties
    This WAR file is deployed to a BEA Weblogic cluster with 2 BEA managed instances.
    Problem: Both these BEA instances right the log4j logging information to a same file (application-server.log).
    I wanted these 2 BEA instances to right their logs to their respective log files rather than combining into one.
    Please advise how to separate the logging of these 2 instances into 2 different files.
    Here is my log4j.properties.
    ####################################  LOGGERS
    ###### Default
    log4j.rootLogger=ERROR, CONSOLE, APPLICATION_SERVER
    log4j.debug=true
    ###### 3rd-Party Loggers
    log4j.logger.org.apache=ERROR
    ###### Appian Loggers
    log4j.logger.com.myappscorp=ERROR
    # Note: To add a more specific logger, drill down to the class package.
    # E.g. log4j.logger.com.myappscorp.process=DEBUG
    ####################################  APPENDERS
    ###### CONSOLE appender
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
    log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
    ###### APPLICATION_SERVER file appender
    log4j.appender.APPLICATION_SERVER=org.apache.log4j.RollingFileAppender
    log4j.appender.APPLICATION_SERVER.layout=org.apache.log4j.PatternLayout
    log4j.appender.APPLICATION_SERVER.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
    log4j.appender.APPLICATION_SERVER.File=/opt/myapps/myapps56/logs/application-server.log
    log4j.appender.APPLICATION_SERVER.MaxFileSize=10MB
    log4j.appender.APPLICATION_SERVER.MaxBackupIndex=1000

    Here you go ..................
    #                            LOG FILE CONFIGURATION
    # Rolling appender logger for ITIM
    log4j.rootCategory=DEBUG, Logger
    #Levels of Logging INFO: info and fatal  FATAL: fatal only
    #                  DEBUG: debug, info and fatal WARN: fatal only
    # Rolling file appender used for logging.
    log4j.appender.Logger=org.apache.log4j.RollingFileAppender
    #UAT
    log4j.appender.Logger.File=/mylogs/myapp/app.log
    log4j.appender.Logger.MaxFileSize=2MB
    log4j.appender.Logger.MaxBackupIndex=10
    #log4j.appender.Logger.DatePattern='.'yyyy-MMM-dd
    log4j.appender.Logger.layout=org.apache.log4j.PatternLayout
    log4j.appender.Logger.layout.ConversionPattern=%d{yyyy MMM dd HH:mm:ss,SSS} %-5p : %m%nnull

  • [log4j] problem with appender file

    Hi
    i create a new fonctionnality in my web application that needs to write in a specific file some informations. So i create a new appender ..and all it's OK
    but now i imagiine that someone change the right off my new appender file : for example suppose that the rights are readonly . I supposed that log4j me an IOException but nothing
    my question is informe that the new appender file is readonly
    PS : my jdk version is 1.3
    Best regards

    Hi, hari,
    I met the same problem as yours. Did you solve it?
    Thanks.

  • WLS log4j problem

    Hi All,
    I have a web app deployed on WLS 8.1. It works fine, but recently I have noticed that after a while WLS loses reference to log4j.
    In the beginning I see the debugging statements printed by log4j but after a while they are not wonder if some one can shed some light onthis problem.
    Thanks

    check the log4j.properties file which you have set in
    PropertyConfigurator.configure("path of log4j.properties file");
    1.check whether all the classes are registered in log4j.prop file
    2.check whether Logger log = Logger.getLogger(YourJava.class) is there in every class and it points to the correct class
    3.check the log4j.appender for all classes in properties file.
    4.check if your web server has already configured with log4j (log4j.xml file) if it is then disable it.

  • Log4j problem  ----   VERY VERY URGENT PLEASE

    Hi,
    I am new to log4j. In my project( web application -- a testing framework ), there is a requirement to log the errors in a different filres for different requests ( the request may come simultaneously ) , by taking the log file path from the user interface.
    To achive the requirement , I am taking both the log file name and log4j.xml file path from the user interface and updating the log4j.xml at runtime, So I am able to log for different requst in different files , but while the 2nd log4j.xml ( the log4j.xml for 2nd request ) is configured ( using DOMConfigurator.configure ) , the errors which are belongs to 1st request are also wrriten in the 2nd log file ( which is configured by log4j.xml -- 2n request ) .
    Please help me to find out the solution for this problem( to log in different files for different request distinctly ).
    Thanks in advance

    chandan111 wrote:
    Please help me to find out the solution for this problem( to log in different files for different request distinctly ).Since this was "very very urgent", I'm probably too late. Anyway:
    The correct way to do this in Log4j would be to use the NDC (Nested Diagnostic Context ) class.
    Article

  • Log4j problem, pls help.

    Sorry this must be trivia to some of you. I am a newbie in this area.
    I want my log file to be appeared in some specific directory, say, c:\temp\
    This is my code :
    static Category cat = Category.getInstance(MyClass.class.getName());
    cat.info("blah....");No problem in compilation. But I couldn't find my log file when run. Where is my log directory by default? And how to set to some specific directory?
    I tried to refer to its example code and documentation but couldn't find any clue.
    Please help.

    You need to configure log4j. Make a log4j.properties file that you put in a directory that's in your classpath. The contents of the file should look something like this:
    log4j.rootCategory=DEBUG,file
    log4j.appender.file=org.apache.log4j.FileAppender
    log4j.appender.file.File=C:/temp/zerg2000.log
    log4j.appender.file.layout=org.apache.log4j.PatternLayout
    log4j.appender.file.layout.ConversionPattern=%d %-5p [%t] %c.%M (%F:%L) - %m%n
    Read the documentation of log4j a bit better, it is really in there, including examples.
    Jesper

  • Log4j Problem: No appenders could be found for logger

    I am migrating an existing app to log4j. I am using log4j 1.2.9. I have added the jar file to the classpath ahead of the weblogic classpath. I am using the log4j.xml file in the WEB-INF\classes directory. I get the following:
    log4j:WARN No appenders could be found for logger (com.kstorm.logging.compdir).
    log4j:WARN Please initialize the log4j system properly.\\
    From reading I get the impression it is a path/classpath problem. I then added the log4j.xml to the path and still got the error.
    Can anyone give me a hand with this?

    Hello,
    It looks like log4j has not found your log4j config file.
    Make sure your config file is present and visible to your application. Is your config file wrapped up in a war file?
    You may also see this error (rarely) if log4j is reading/picking up a differernt config file from the one you are expecting it to find (the one with your appender in it) in this unlikely case try searching for other possible log4j config files.
    Cheers
    Hussein Badakhchani
    www.orbism.com

  • Log4j problem in JSF

    I'm trying to use log4j in my bean, but not work and prompt error messages,
    then I change Log4j to commons-logging, it's working.
    My container is Tomcat 5.0, Any suggestions?
    Thanks for any help!

    Hi,
    Can you give the steps or configuration involnved in making JSF work with Common-loging/Log4j,
    I am using sun studio creator,But I am not able to get any loggin message ,
    I have put log4j.properties in WEB-INF folder,then also my log file is not getting created,
    Please guide me with configuaration steps,
    Thanks in advance,
    Vani

  • LOG4j   problem in Java application

    Hi,
    I am using a standalone java program in my application.
    This program consists of 5/6 classes.
    These Class es are communicating Via method call.
    Now I have to implemented log4j logging mechanisim.
    in the main class , if I write
    /*  STATIC BLOCK TO LOAD  LOG PROPERTIES  FILE */
        static{
            PropertyConfigurator.configure("conf//commLog.properties");
        }// end static blockand in the other calling classes if I use
    private Logger log = Logger.getLogger(Communicator.class);
    log.info(......);Is it working as a File appender Logging ???
    What is the best approach to use log4j in this type off Application?
    How can I load log4j during the start up of any desktop application and use it in File appender mode through out the application?

    You have to config your log4j.properties file in your case commLog.properties
    here is an example:
    log4j.Logger=rooLog
    log4j.appender.rootLog=org.apache.log4j.FileAppender
    log4j.appender.rootLog.File=yourLogOutputFile
    log4j.appender.rootLog.MaxFileSize=3MB
    log4j.appender.rootLog.MaxBackupIndex=3
    log4j.appender.rootLog.layout=org.apache.log4j.PatternLayout
    log4j.appender.rootLog.layout.ConversionPattern=%d{ISO8601} %5p [%t] (%F:%L) - %m%n

Maybe you are looking for