Log4j jdbcAppender problem

Hi,
I'm having trouble configuring jdbcAppender for log4j.
I have successfully configured it by specifying a SQL statement in the properties file:
log4j.appender.JDBC2.sql=INSERT INTO TEST (TIMESTAMP, CATEGORY, ERROR_MSG) VALUES (sysdate, @CAT@, @MSG@)
The trouble with this is that I have to truncate the MSG to the ERROR_MSG field size. I do not want to use a JDBCSQLHandler class as this would mean that I will have to change the class every time the table and column names change.
Instead, I tried the alternate configuration method:
log4j.appender.JDBC2.table=test
log4j.appender.JDBC2.column=id~EMPTY
log4j.appender.JDBC2.column=timestamp~TIMESTAMP
log4j.appender.JDBC2.column=category~CAT
log4j.appender.JDBC2.column=error_msg~MSG
I will add a JDBCColumnHandler class that will do the truncating.
But this configuration is not working for me. I get the following error msg:
"log4j:ERROR Not ready to append ! Column ID is not nullable, and must be specified by setLogType() !"
The ID Column has a trigger associated with it that automatically populates it. I have come to the conclusion that only the last column definition is being configured. If I move the column=id~EMPTY to be the last column defined in the properties file, I no longer get that error msg. But no records are created, possibly because the only column defined was ID and it was configured as EMPTY and hence was ignored.
It works if I use the same configuration style in an xml file:
          <param name="table" value="test" />
          <param name="column" value="id~EMPTY" />
          <param name="column" value="timestamp~TIMESTAMP" />
          <param name="column" value="category~CAT" />
          <param name="column" value="error_msg~MSG" />
I would appreciate any help you could provide.
Cheers,
Nim

To all the JAVA GURUS,
I need to have an audit feature in my application which keeps a track(history) of changes made at any instance.
To be very precise say i have some values say 8, 5, 10, 12... if i modify any one of these value the utility should be able to trace out the changes made and other information like logger's id timestamp etc etc.... but only when the value is actually changed in a sense, suppose the value is 8 and was erased and again set to 8 then it is not considered a change...
I want to have a solution using log4j which can record these changes in Oracle database... along with additional infornmation related to the change(may be the reason for the change).
Thanks!!!
[email protected]

Similar Messages

  • RollingFileAppender/Log4J question (problem with reading logging)

    Hi everyone,
    I've got a question about log4j.
    I'm working with an application that generates a lot of logging. When I'm trying to figure out problems in the application it's hard to read the log files because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is that when the maximum file size is reached a new log file is created with <filename>.1 and the name of every file that already existed is increased with 1.
    So when I try to read my logfiles they get overwritten while I'm reading it because the application generates a new logfile sometimes 4 times per minute. That's very annoying, so what I would like to have is that everytime a new logfile is created it's number is increased with 1 until a maximum of files and then start over.
    I've been trying to find this mechanism somewhere but can't find it. The DailyRollingFileAppender kinda does what I want but you can't set a maximum of files and I can't have that because of the space available on the server.
    Does anyone know how to solve this?

    I've got a question about log4j.
    I'm working with an application that generates a lot
    of logging. When I'm trying to figure out problems in
    the application it's hard to read the log files
    because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is
    that when the maximum file size is reached a new log
    file is created with <filename>.1 and the name of
    every file that already existed is increased with 1.
    So when I try to read my logfiles they get
    overwritten while I'm reading it because the
    e application generates a new logfile sometimes 4
    times per minute. That's very annoying, so what I
    would like to have is that everytime a new logfile is
    created it's number is increased with 1 until a
    maximum of files and then start over.That's not Log4J's problem. That's your problem for treating log files like production data. Maybe you need to use something else, like writing this supposedly persistent data to a database.
    I've been trying to find this mechanism somewhere but
    can't find it. The DailyRollingFileAppender kinda
    does what I want but you can't set a maximum of files
    and I can't have that because of the space available
    on the server.What stops you from introducing another periodic process, to purge old log files? That's what most would do.

  • Log4j RollingFileAppender problem

    We are having problems using the RollingFileAppender in a Weblog 7 application.
    We are noticing that there are missing backups on our server. Here is the log4j
    configuration file:
    ===========================================
    #set the level of the root logger at debug and define the appender
    log4j.rootLogger=DEBUG, R
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=logs/WB.log
    #size the log file at 10MB
    log4j.appender.R.MaxFileSize=10MB
    # Keep ten backup files
    log4j.appender.R.MaxBackupIndex=10
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c -> %m%n
    #turn off logging for the apache classes
    log4j.logger.org.apache=OFF
    ==============================================
    One other thing we noticed was that Weblogic appears to open the base log file
    as soon as the server is started. It does not relinquish control of the file.
    Is this the case?
    The directory of our server looks like this today:
    WB.log
    WB.log.9
    WB.log.10
    Any help is appreciated.
    Thanks,
    Will

    I've got a question about log4j.
    I'm working with an application that generates a lot
    of logging. When I'm trying to figure out problems in
    the application it's hard to read the log files
    because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is
    that when the maximum file size is reached a new log
    file is created with <filename>.1 and the name of
    every file that already existed is increased with 1.
    So when I try to read my logfiles they get
    overwritten while I'm reading it because the
    e application generates a new logfile sometimes 4
    times per minute. That's very annoying, so what I
    would like to have is that everytime a new logfile is
    created it's number is increased with 1 until a
    maximum of files and then start over.That's not Log4J's problem. That's your problem for treating log files like production data. Maybe you need to use something else, like writing this supposedly persistent data to a database.
    I've been trying to find this mechanism somewhere but
    can't find it. The DailyRollingFileAppender kinda
    does what I want but you can't set a maximum of files
    and I can't have that because of the space available
    on the server.What stops you from introducing another periodic process, to purge old log files? That's what most would do.

  • Log4j time problem in Solaris

    Hi,
    I have different behavior of log4j on windows and Solaris.
    I get wrong time entry in log file for march month in Solaris machine.
    i.e if the console displays date & time as Thu Mar 29 06:29:39 EDT 2007
    then i get [29 Mar 2007 05:29]
    but i gives me correct time for all other months & in windows.
    Why it occurs. please give me solution for this
    Thanks in advance

    hi, i meet another problem, my log4j cannot log into the log file, the properties code as following
    log4j.rootLogger=INFO, LOGFILE
    log4j.appender.LOGFILE=org.apache.log4j.FileAppender
    log4j.appender.LOGFILE.File=myApplication.log
    log4j.appender.LOGFILE.Append=false
    log4j.appender.LOGFILE.Threshold=DEBUG
    log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.LOGFILE.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss a}  (%c %M:Line %L)%n%p - %m%nmy code was work in windowXP with weblogic, but failed in Solaris with weblogic.
    Do you have any idea?

  • [help~~~~]log4j dailyrollingfileappender problem

    I'm feeling very confused when I use log4j.I want to get log output everyday to files whose names are with time postfix.the java property file is in the below:
    log4j.logger.DEL=WARN,Dellog4j.appender.Del=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.Del.File=LOG/20
    log4j.appender.Del.DatePattern=yyMMdd-'deleteLog.txt'log4j.appender.Del.layout=org.apache.log4j.PatternLayout
    log4j.appender.Del.layout.ConversionPattern=%-d [%c]-[%p] %m %-d{yyyy-MM-dd HH:mm:ss}%n
    But I can't get what I want,instead I got error like this:
    log4j:ERROR Failed to rename [LOG/20] to [LOG/20.2006-03-28]
    when I run the project under Linux system,I can get the right result.But I really want to use it under Windows system.Could somebody do me a favor to help me??

    I don't use the slash second time,I just don't want to rewrite the same thing once more.I think the slash is ok,when I run it a folder would be create,therefore I followed you to delete that slash,but I still have that problem.If you don't want to help me,you can keep silent,why do you say those words??I saw one person asked about log4j,but it's of year2005,so I think maybe I can get help here,but you made me so upset.I think to a programmer,to be patient is very important,I am patient,but I can't keep patient for 3 days to solve only one problem with so many things left to do!

  • Log4j message Problem

    Problem description: my logger.info statements from my classes are logged in to the app.log file which is my application log file and also on my Websphere console (System out.log ) staements are displaying , actually my requirement is to see logger statements in my application log file i.e. (app.log file) but not in console. how to stop my logging statements to appear in console?
    Is thereanything i am missing here !!!
    I am loading log4j. properties using the following line in one of my classes ...
    PropertyConfigurator.configure(/usr/log/log4j.properties);
    Log4j.properties
    log4j.rootLogger=ERROR
    # Specify where to log by packages.
    log4j.logger.com.abc.example=INFO,dest1
    log4j.appender.dest1=org.apache.log4j.RollingFileAppender
    log4j.appender.dest1.File=app.log
    log4j.appender.dest1.MaxFileSize=10000KB
    log4j.appender.dest1.MaxBackupIndex=30
    log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
    #log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    #log4j.appender.stdout.Target=System.out
    #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    #log4j.appender.sdtout.Threshold=ERROR
    Thanks in Advance,
    J.P.Sastry (SCJP,SCWCD,SCBCD)
    Edited by: PunnayyaSastryJandhyala on May 8, 2008 8:07 PM

    don't use System.out.println, it always prints at server console.
    in fact we implement LOG4J to avoid writing System.out.println statements, log all System.out.println statements with Logger.info.
    pvmk
    Edited by: pvmk on May 9, 2008 12:29 AM

  • LOG4J JDBCAppender error

    hi all,
    i am trying to log to a DB using the JDBC appender
    while i try with files i mean file appender i am sucessful
    but when i try to do the jdbc appender with the following property file
    # config file for JDBCAppender:
    log4j.rootCategory=ALL, jdbc
    # JDBCAppender writes messages into the database
    log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender
    #SQL statement to be used (with multiple columns formated)
    log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(LOG_ID) values ('%m')
    # DB Options
    log4j.appender.jdbc.URL=jdbc:odbc:myDB
    log4j.appender.jdbc.user=me
    log4j.appender.jdbc.password=password
    #set the buffer size
    log4j.appender.JDBC.buffersize=1
    ------------- and when i compile my program and i run it it says the LOG4jSystem is not intiliazed properly!!!
    my code is compiling fine .
    please help me in this!!!

    Thanks a lot... I have tried and its working... I wrote :-
    log4j.rootLogger=DEBUG, CONSOLE
    log4j.appender.FILE=org.apache.log4j.FileAppender
    log4j.appender.FILE.file=/tmp/logs/log.txt
    log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.FILE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
    log4j.appender.CONSOLE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n

  • Weblogic 10.0 and Log4j classpath problem

    My applications were working fine in WLS 9 but when I upgaded to WLS 10 I started getting log4j configuration and resource finding errors.
    Basically, if I do a "Logger.class.getClassLoader().getResourceAsStream(file)" I get a null pointer excep. bec. the classloader can't find the file that's packed within the EAR.
    Log4j.jar is in my web-inf/lib folder. I also tried putting it in APP-INF/lib to no avail
    Note: In WLS 9.2, there is a log4j jar in BEA_HOME/common/lib and a wllog4j in BEA_HOME/server/lib. So.... it looks like the log4j jar was in the classpath before too. So, not sure what's going on with 10.0
    Any insight into this would be greatly appreciated.
    Edited by mariorod at 05/15/2008 2:47 PM

    Thanks!
    I tried using the same log4j version that WLS10 uses (log4j 1.2.13) and ....... it still didn't work!
    From reading the URL that you stated above, it looks like if log4j 1.2.13 exists in WEB-INF/lib and the WLS modules dir, then WLS will still load the log4j classes from the SYSTEM CP rather than from the web app CP.....
    That seems to explain why even after updating my lib to use the same jar, it still can't find a resource in the web app..
    Is this assumption correct/wrong?
    Any other ideas anyone?
    Edited by mariorod at 05/16/2008 8:33 AM

  • JMX-Log4j Appender problem

    Dear listers
    we wrote thefollowing code to log the loglevel's dynamically.
    Following is the code
    public class MyApp implements MyAppMBean {     
    private static Logger logger = Logger.getLogger(MyApp.class);
    public void go() throws Exception{
    while(true){
    logger.debug("DEBUG") ;
    logger.info("INFO") ;
    logger.warn("WARN");
    logger.error("ERROR");
    logger.fatal("FATAL");
    Thread.sleep(2000);
    public void setLoggingLevel(String level){
    logger.info("Setting logging level to: " + level);
    Level newLevel = Level.toLevel(level, Level.INFO);
    Logger.getRootLogger().setLevel(newLevel);
    public String getLoggingLevel(){                       
    return Logger.getRootLogger().getLevel().toString() ;
    public static void main(String[] args) throws Exception
    DOMConfigurator.configure("log4j.xml");
    MyApp app = new MyApp();
    //Lookup for the mbean server
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    //Create and register the top level log4j MBean
    HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
    ObjectName mbo = new ObjectName("log4j:logger=root");
    System.out.println("Debug10");
    server.registerMBean(hdm, mbo);
    LoggerRepository r = LogManager.getLoggerRepository();
    Enumeration<Logger> elogs = r.getCurrentLoggers();
    Logger logger = null;
    while(elogs.hasMoreElements())
    //need to show the elements of teamcenter only.
    logger = (Logger)elogs.nextElement();
    hdm.addLoggerMBean(logger.getName());
    } System.out.println(Logger.getRootLogger().getLevel().toString());
    int portNumber=9999;
    ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
    HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
    html.setPort(portNumber);
    server.registerMBean(html, htmlName);
    html.start();
    app.go();
    When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
    *477 All Attributes Not Set*
    *1/8 attribute(s) were not set:*
    appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
    Please advice how can we solve this issue ~Vilas

    Dear listers
    we wrote thefollowing code to log the loglevel's dynamically.
    Following is the code
    public class MyApp implements MyAppMBean {     
    private static Logger logger = Logger.getLogger(MyApp.class);
    public void go() throws Exception{
    while(true){
    logger.debug("DEBUG") ;
    logger.info("INFO") ;
    logger.warn("WARN");
    logger.error("ERROR");
    logger.fatal("FATAL");
    Thread.sleep(2000);
    public void setLoggingLevel(String level){
    logger.info("Setting logging level to: " + level);
    Level newLevel = Level.toLevel(level, Level.INFO);
    Logger.getRootLogger().setLevel(newLevel);
    public String getLoggingLevel(){                       
    return Logger.getRootLogger().getLevel().toString() ;
    public static void main(String[] args) throws Exception
    DOMConfigurator.configure("log4j.xml");
    MyApp app = new MyApp();
    //Lookup for the mbean server
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    //Create and register the top level log4j MBean
    HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
    ObjectName mbo = new ObjectName("log4j:logger=root");
    System.out.println("Debug10");
    server.registerMBean(hdm, mbo);
    LoggerRepository r = LogManager.getLoggerRepository();
    Enumeration<Logger> elogs = r.getCurrentLoggers();
    Logger logger = null;
    while(elogs.hasMoreElements())
    //need to show the elements of teamcenter only.
    logger = (Logger)elogs.nextElement();
    hdm.addLoggerMBean(logger.getName());
    } System.out.println(Logger.getRootLogger().getLevel().toString());
    int portNumber=9999;
    ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
    HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
    html.setPort(portNumber);
    server.registerMBean(html, htmlName);
    html.start();
    app.go();
    When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
    *477 All Attributes Not Set*
    *1/8 attribute(s) were not set:*
    appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
    Please advice how can we solve this issue ~Vilas

  • Log4j configuration problem

    Can anyone explain why every line in the log file is printed twice - this is my log4j configuration file.
    thanks...
    Liat
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <!-- ===================================================================== -->
    <!--                                                                       -->
    <!--  Log4j Configuration                                                  -->
    <!--                                                                       -->
    <!-- ===================================================================== -->
    <!-- $Id: log4j.xml,v 1.1 2003/10/29 11:00:45 avir Exp $ -->
    <!--
       | For more configuration infromation and examples see the Jakarta Log4j
       | owebsite: http://jakarta.apache.org/log4j
    -->
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
             <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
            <param name="File" value="./BitbandClient.log"/>
            <param name="Append" value="true"/>
            <!-- Rollover at midnight each day -->
            <param name="DatePattern" value="'.'yyyy-MM-dd"/>
            <!-- Rollover at the top of each hour
            <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
            -->
            <layout class="org.apache.log4j.PatternLayout">
                <!-- The default pattern: Date Priority [Category] Message\n -->
                <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    <!--                            %-4r [%t] %-5p %c %x - %m%n-->
                <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
                <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
                 -->
            </layout>
        </appender>
        <!-- ============================== -->
        <!-- Append messages to the console -->
        <!-- ============================== -->
        <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
                <param name="Target" value="System.out"/>
                <param name="Threshold" value="INFO"/>
                <layout class="org.apache.log4j.PatternLayout">
                    <!-- The default pattern: Date Priority [Category] Message\n -->
                    <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
                </layout>
        </appender>
         <appender name="BITBAND-CONSOLE" class="org.apache.log4j.ConsoleAppender">
             <param name="Target" value="System.out"/>
             <param name="Threshold" value="DEBUG"/>
             <layout class="org.apache.log4j.PatternLayout">
              <!-- The default pattern: Date Priority [Category] Message\n -->
              <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c] - %m%n "/>
             </layout>
        </appender>
        <category name="com.bitband.maestro">
            <priority value="DEBUG"/>
            <appender-ref ref="BITBAND-CONSOLE"/>
            <appender-ref ref="FILE"/>
        </category>
        <!-- ======================= -->
        <!-- Setup the Root category -->
        <!-- ======================= -->
         <root>
             <priority value="INFO"/>
             <appender-ref ref="CONSOLE"/>
             <appender-ref ref="FILE"/>
        </root>
    </log4j:configuration>

    You're just begging for a [url http://en.wikipedia.org/wiki/RTFM]four-letter response :-)
    http://logging.apache.org/log4j/docs/manual.html
    The addAppender method adds an appender to a given logger. Each enabled logging request for a given logger will be forwarded to all the appenders in that logger as well as the appenders higher in the hierarchy. In other words, appenders are inherited additively from the logger hierarchy. For example, if a console appender is added to the root logger, then all enabled logging requests will at least print on the console. If in addition a file appender is added to a logger, say C, then enabled logging requests for C and C's children will print on a file and on the console. It is possible to override this default behavior so that appender accumulation is no longer additive by setting the additivity flag to false.

  • Log4j classpath problems

    Hi.
    I wrote a message driven bean and deployed it succesfully to bea. now i am trying
    to incorporate log4j.
    my bean compiles fine. to use log4j, i have imported org/apache/log4j/*
    but when i try to deploy to bea, i get errors saying :
    Unable to deploy EJB: vemMessageBean.jar from vemMessageBean.jar:
    java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
    at com.mgb.vem.beans.VEMMessageBean.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39) ....
    i have tried placing log4j.jar in my applications directory...that didnt work.
    I tried editing my domain's setEnv to point to weblogic81/common/lib/log4j
    that didnt work
    Can someone help me ? What am i doing wrong ?
    thanks
    nish

    Hi.
    I wrote a message driven bean and deployed it succesfully to bea. now i am trying
    to incorporate log4j.
    my bean compiles fine. to use log4j, i have imported org/apache/log4j/*
    but when i try to deploy to bea, i get errors saying :
    Unable to deploy EJB: vemMessageBean.jar from vemMessageBean.jar:
    java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
    at com.mgb.vem.beans.VEMMessageBean.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39) ....
    i have tried placing log4j.jar in my applications directory...that didnt work.
    I tried editing my domain's setEnv to point to weblogic81/common/lib/log4j
    that didnt work
    Can someone help me ? What am i doing wrong ?
    thanks
    nish

  • HELP REQUIRED VERY URGENT!!  LOG4J

    if my understanding is not wrong while using LOG4J JDBCappender to write to a DataBase using configurator file(Property file), the SQL will be written in the property file and the message to be logged into the DB will be passed from the program(java file ) to the log4J system using the log.debug or any other way.
    for eg: INSERT INTO JDBCTEST (Date, Logger, Priority, Message) VALUES ('%d', '%c', '%p', '%m')
    here the only message passed t th eLOG4J system is the Message field value which is
    represnted by the %m field(inside the value block) and rest are kind of constants , like for date (where we can use sysdate) and the logger and priority level which all are constants and not part of the message passed to the system(LOG4J system).
    the trouble we found was in separating the single message we send to the LOG4J system
    for eg: suppose if the message we send to the LOG4J system is
    " methodname=ABC() timetaken=1.5secs date=28/7/2006 "
    i am confused about the way to split the message into say 3 parts
    like
    methodname=ABC()
    methodname=ABC()
    date=28/7/2006
    and insert into different columns of the table
    Hope you got a goog broader view of the problem i am facing.

    Have you tried PreparedStatement?
    Here's an example (from the O'REILLY Java Servlet Programming book)
    PreparedStatement pstmt = con.prepareStatement("INSERT INTO ORDERS (ORDER_ID, CUSTOMER_ID, TOTAL) VALUES(?,?,?)");
    //Other code
    pstmt.clearParameters(); //clear any previous parameter values
    pstmt.setInt(1, 2); //set ORDER_ID
    pstmt.setInt(2, 4); //set CUSTOMER_ID
    pstmt.setDouble(3, 53.43); //set TOTAL
    pstmt.executeUpDate(); //execute the stored SQL
    If you want to set a String value, use the setString method.
    Does that help?

  • Weblogic 10.1 web apps merge log4j log files into single log file

    Hi
    I have deployed multiple web applications on my weblogic (v 10.1 - JDK 1.5.0_12). I am using log4j-1.2.13.jar in a four different web applications.
    The location for the files are - WEB-INF\lib\log4j-1.3.13.jar and WEB-INF\classes\log4j.properties
    When I deployed all the four webapps in weblogic - we found that all of the apps started writing their logs into the logfile which is configured in the log4j of the first web apps log file. The "first web app" is the web app which is the first app deployed in weblogic.
    I have deployed all the four webapps in Tomcat and found that four separate log files get created. Hence, this problem is unique to Weblogic.
    Any suggestions on what the problem could be? I have been battling with this issue for over a week- and have exhausted all ideas.
    Thank you,
    Ronak S.

    Hi ,
    Read all about your issue here :
    Weblogic 10.0 and Log4j classpath problem
    Issue is that the Weblogic system classloader includes log4J already..
    Use "Filtering ClassLoader" a mechanism to configure deployment descriptors to explicitly specify that certain packages should always be loaded from the application, rather than being loaded by the system classloader.
    see: http://e-docs.bea.com/wls/docs100/programming/classloading.html#wp1097187
    Example:
    Add following to your META-INF/weblogic-application.xml
    <prefer-application-packages>
    <package-name>org.apache.log4j.*</package-name>
    </prefer-application-packages>
    Exclude all library packages used within your applcation to have full control over what is used by the application.
    regards,
    Kris

  • Logging on EJB

    Hi, I am developing an EJB layer for JSF+Servlet web layer.
    So for web layer I used log4j without problems but I haven't any idea about doing logging on EJB layer, anyone have a suggest ?

    Hi,
    I quickly tried Google and found many hints and tips (plus book references). So I suggest to try Google in case you don't get an answer here on the forum. Another option is to ask the question on the J2EE forum
    OC4J
    Frank

  • Logging with EJB

    Hi, I am developing an EJB layer for JSF+Servlet web layer.
    So for web layer I used log4j without problems but I haven't any idea about doing logging on EJB layer, anyone have a suggest ?

    should work similarly, except you may have to configure your loggers in the appserver log4j config instead of at application level.

Maybe you are looking for