⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readerthread.java

📁 pl/sql中记log的函数
💻 JAVA
字号:
package log4plsql.backgroundProcess;


/*
 * Copyright (C) LOG4PLSQL project team. All rights reserved.
 *
 * This software is published under the terms of the The LOG4PLSQL 
 * Software License, a copy of which has been included with this
 * distribution in the LICENSE.txt file.  
 * see: <http://log4plsql.sourceforge.net>  */
 
 
import oracle.xml.parser.v2.XMLNode;
import org.apache.log4j.Logger;



/**
 * Thread to drive a database pooling
 * @author 	guillaume Moulard 
 * @version 	1.0   
 * @since       LOG4PLSQL V3.1.2
 */
class ReaderThread extends Thread {

  private  XmlConfig lxmlConfig;
  private  Logger ldbLogger;
  private  ReaderLogDataBase readerDB;


/**
* Drive a connection to database
*/
public ReaderThread (XMLNode xmlNodeConfig,
                        Logger dbLogger ) {
    lxmlConfig = new XmlConfig(xmlNodeConfig); 
 
    ldbLogger = ldbLogger.getLogger("backgroundProcess.ReaderLogDataBase.ReaderDBThread");

    ldbLogger.debug("ReaderLogDataBase : Connect");
    readerDB = new ReaderLogDataBase( 
            lxmlConfig.getXpathParam("database/source/connection/dburl/text()", "NotExiste"),
            lxmlConfig.getXpathParam("database/source/connection/username/text()", "NotExiste"),
            lxmlConfig.getXpathParam("database/source/connection/password/text()", "NotExiste"),
            lxmlConfig.getXpathParam("database/source/pipename/text()", "NotExiste"),
            lxmlConfig.getXpathParam("@name", "noName")
            );
}


/**
* in loop, write a message in database to log4j logger 
*/
  public void run() {
      while (true) {
          readerDB.readlog(ldbLogger); 
          try {
              sleep(1000);
          } catch(InterruptedException e) {
              ldbLogger.error(e);  
          }
      }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -