logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: logging-log4j-sandbox/src/java/org/apache/log4j/jdbc JDBCReceiver.java JDBCReceiverBeanInfo.java
Date Thu, 19 Aug 2004 15:54:09 GMT
sdeboy      2004/08/19 08:54:09

  Modified:    src/java/org/apache/log4j/jdbc JDBCReceiver.java
                        JDBCReceiverBeanInfo.java
  Log:
  Updated to use new loggingevent constructor
  
  Revision  Changes    Path
  1.16      +66 -20    logging-log4j-sandbox/src/java/org/apache/log4j/jdbc/JDBCReceiver.java
  
  Index: JDBCReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j-sandbox/src/java/org/apache/log4j/jdbc/JDBCReceiver.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JDBCReceiver.java	28 Feb 2004 13:55:04 -0000	1.15
  +++ JDBCReceiver.java	19 Aug 2004 15:54:09 -0000	1.16
  @@ -1,17 +1,50 @@
   /*
  - * Copyright 1999,2004 The Apache Software Foundation.
  - * 
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - * 
  - *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  + * ============================================================================
  + *                   The Apache Software License, Version 1.1
  + * ============================================================================
  + *
  + *    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + *
  + * 1. Redistributions of  source code must  retain the above copyright  notice,
  + *    this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include  the following  acknowledgment:  "This product includes  software
  + *    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  + *    Alternately, this  acknowledgment may  appear in the software itself,  if
  + *    and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "log4j" and  "Apache Software Foundation"  must not be used to
  + *    endorse  or promote  products derived  from this  software without  prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + *
  + * 5. Products  derived from this software may not  be called "Apache", nor may
  + *    "Apache" appear  in their name,  without prior written permission  of the
  + *    Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + * APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + * ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + * (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + *
  + * This software  consists of voluntary contributions made  by many individuals
  + * on  behalf of the Apache Software  Foundation.  For more  information on the
  + * Apache Software Foundation, please see <http://www.apache.org/>.
  + *
    */
   
   package org.apache.log4j.jdbc;
  @@ -30,6 +63,7 @@
   import org.apache.log4j.plugins.Receiver;
   import org.apache.log4j.spi.LocationInfo;
   import org.apache.log4j.spi.LoggingEvent;
  +import org.apache.log4j.spi.ThrowableInformation;
   
   
   /**
  @@ -268,7 +302,16 @@
             }
             rs = statement.executeQuery(newSql);
   
  +          int i = 0;
             while (rs.next()) {
  +            if (++i == 1000) {
  +                synchronized(this) {
  +                    try {
  +                        wait(300);
  +                    } catch (InterruptedException ie) {}
  +                    i = 0;
  +                }
  +            }
               logger = Logger.getLogger(rs.getString("LOGGER"));
               timeStamp = rs.getTimestamp("TIMESTAMP").getTime();
   
  @@ -342,13 +385,16 @@
               Level levelImpl = Level.toLevel(level);
   
               LoggingEvent event =
  -              new LoggingEvent(
  -                logger.getName(), logger, timeStamp, levelImpl, threadName,
  -                message, ndc, mdc, exception,
  -                new LocationInfo(fileName, className, methodName, lineNumber),
  -                properties);
  -
  -              if (!isPaused()) {
  +              new LoggingEvent(logger.getName(), logger,levelImpl, message, null);
  +            event.setLocationInformation(new LocationInfo(fileName, className, methodName,
lineNumber));
  +            properties.putAll(mdc);
  +            event.setTimeStamp(timeStamp);
  +            event.setThrowableInformation(new ThrowableInformation(exception));
  +            
  +            event.setProperties(properties);
  +            event.setThreadName(threadName);
  +            event.setNDC(ndc);               
  +            if (!isPaused()) {
                     doPost(event);
                 }
             }
  
  
  
  1.3       +47 -14    logging-log4j-sandbox/src/java/org/apache/log4j/jdbc/JDBCReceiverBeanInfo.java
  
  Index: JDBCReceiverBeanInfo.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j-sandbox/src/java/org/apache/log4j/jdbc/JDBCReceiverBeanInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCReceiverBeanInfo.java	28 Feb 2004 13:55:04 -0000	1.2
  +++ JDBCReceiverBeanInfo.java	19 Aug 2004 15:54:09 -0000	1.3
  @@ -1,17 +1,50 @@
   /*
  - * Copyright 1999,2004 The Apache Software Foundation.
  - * 
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - * 
  - *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  + * ============================================================================
  + *                   The Apache Software License, Version 1.1
  + * ============================================================================
  + *
  + *    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + *
  + * 1. Redistributions of  source code must  retain the above copyright  notice,
  + *    this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include  the following  acknowledgment:  "This product includes  software
  + *    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  + *    Alternately, this  acknowledgment may  appear in the software itself,  if
  + *    and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "log4j" and  "Apache Software Foundation"  must not be used to
  + *    endorse  or promote  products derived  from this  software without  prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + *
  + * 5. Products  derived from this software may not  be called "Apache", nor may
  + *    "Apache" appear  in their name,  without prior written permission  of the
  + *    Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + * APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + * ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + * (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + *
  + * This software  consists of voluntary contributions made  by many individuals
  + * on  behalf of the Apache Software  Foundation.  For more  information on the
  + * Apache Software Foundation, please see <http://www.apache.org/>.
  + *
    */
   package org.apache.log4j.jdbc;
   
  @@ -40,7 +73,7 @@
                   new PropertyDescriptor("user", JDBCReceiver.class),
                   new PropertyDescriptor("password", JDBCReceiver.class),
                   new PropertyDescriptor("IDField", JDBCReceiver.class),
  -                new PropertyDescriptor("driver", JDBCReceiver.class),
  +                new PropertyDescriptor("Driver", JDBCReceiver.class),
               };
           } catch (Exception e) {
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message