Package org.apache.log4j

Examples of org.apache.log4j.Category$PrivateManager


     
      // convert the JMS message in the Oracle type TLogQueue
      adtmsg = (AdtMessage) JmsMsg;
        datalog =(TLogQueue)(adtmsg.getAdtPayload());
         
          Category logger = Logger.getLogger(datalog.getLuser()+ "." +datalog.getLsection());
         
          // convert the PL/SQL log level in LOG4J level
          Level level = (DynamicLevel)htLevels.get(new Integer (datalog.getLlevel().intValue()));
 
          if (level != null) {
             priority = level;
          } else {
            priority = Level.toLevel("UNDEFINED",  Level.ERROR );
          }   
         
          // create the LOG4J event
          NDC.push("DatabaseLoginDate:"+datalog.getLdate()) ;
          event = new LoggingEvent(fqnOfCategoryClass,
                                   logger,
                                   priority,
                                   datalog.getLtext(),
                                   myThrowable);
 
 
          logger.callAppenders(event);
          NDC.remove();
          Thread.yield();
        }
    catch (JMSException JMSex) {
      logger.fatal("JMS error during receiving message - " +
                    " JMSException" + JMSex);
    }
    catch (SQLException SQLex) {
      logger.fatal("SQL error during receiving message - " +
                    " SQLException" + SQLex);
    }
    catch (Exception ex) {
      logger.fatal("Error during receiving message - " +
                    " Exception" + ex);
    }

  }
View Full Code Here


    ListHandler listHandler = new ListHandler();
    java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
    root.addHandler(listHandler);
    root.setLevel(Level.FINEST);
    Logger log4jLogger = Logger.getLogger("a");
    Category log4jCategory = Logger.getLogger("b");

    int n = 0;

    log4jLogger.log(org.apache.log4j.Level.DEBUG, "hello"+(++n));
    log4jCategory.log(org.apache.log4j.Level.DEBUG, "world"+(++n));
   
    assertEquals(n, listHandler.list.size());

    for (int i = 0; i < n; i++) {
      LogRecord logRecord = (LogRecord) listHandler.list.get(i);
View Full Code Here

    ListHandler listHandler = new ListHandler();
    java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
    root.addHandler(listHandler);
    root.setLevel(Level.FINEST);
    Logger log4jLogger = Logger.getLogger("a");
    Category log4jCategory = Logger.getLogger("b");

    int n = 0;

    log4jLogger.trace("msg" +(n++));
    log4jLogger.debug("msg" +(n++));
    log4jLogger.info("msg" +(n++));
    log4jLogger.warn("msg" +(n++));
    log4jLogger.error("msg" +(n++));
    log4jLogger.fatal("msg" +(n++));
   
    log4jCategory.debug("msg" +(n++));
    log4jCategory.info("msg" +(n++));
    log4jCategory.warn("msg" +(n++));
    log4jCategory.error("msg" +(n++));
    log4jCategory.fatal("msg" +(n++));
    assertEquals(n, listHandler.list.size());
   
    for(int i = 0; i < n; i++) {
      LogRecord logRecord = (LogRecord) listHandler.list.get(i);
View Full Code Here

  // System.err.flush();
  //}

  public void run() {
  LoggingEvent event;
  Category remoteCategory;
  String strClientName;

  // Get the client name.
  InetAddress addr = socket.getInetAddress();
  strClientName = addr.getHostName();
  if(strClientName == null || strClientName.length() == 0)
  {
    strClientName = addr.getHostAddress();
  }

  try {
    while(true) {
  event = (LoggingEvent) ois.readObject();

  if(event.ndc != null)
  {
    event.ndc = strClientName + ":" + event.ndc;
  }
  else
  {
    event.ndc = strClientName;
  }

  remoteCategory = Category.getInstance(event.categoryName);
  remoteCategory.callAppenders(event);
    }
  }
  catch(java.io.EOFException e) {
    cat.info("Caught java.io.EOFException will close conneciton.", e);
  }
View Full Code Here

    /**
     * Tests LoggingEvent.fqnOfCategoryClass.
     */
  public void testFQNOfCategoryClass() {
      Category root = Logger.getRootLogger();
      Priority info = Level.INFO;
      String catName = Logger.class.toString();
      LoggingEvent event =
        new LoggingEvent(
          catName, root, info, "Hello, world.", null);
View Full Code Here

    /**
     * Tests LoggingEvent.level.
     * @deprecated
     */
  public void testLevel() {
      Category root = Logger.getRootLogger();
      Priority info = Level.INFO;
      String catName = Logger.class.toString();
      LoggingEvent event =
        new LoggingEvent(
          catName, root, 0L,  info, "Hello, world.", null);
View Full Code Here

    /**
     * Tests LoggingEvent.getLocationInfo() when no FQCN is specified.
     * See bug 41186.
     */
  public void testLocationInfoNoFQCN() {
      Category root = Logger.getRootLogger();
    Priority level = Level.INFO;
      LoggingEvent event =
        new LoggingEvent(
          null, root, 0L,  level, "Hello, world.", null);
      LocationInfo info = event.getLocationInformation();
View Full Code Here

     * Tests that an runtime exception or error during toString
     * on the message parameter does not propagate to caller.
     * See bug 37182.
     */
    public void testBadMessage() {
        Category root = Logger.getRootLogger();
        Priority info = Level.INFO;
        String catName = Logger.class.toString();
        BadMessage msg = new BadMessage();
        LoggingEvent event =
          new LoggingEvent(
View Full Code Here

    /**
     * Construct the listener and make sure there is a valid appender.
     */
    public Log4jListener() {
        initialized = false;
        Category cat = Category.getInstance("org.apache.tools.ant");
        Category rootCat = Category.getRoot();
        if (!(rootCat.getAllAppenders() instanceof NullEnumeration)) {
            initialized = true;
        } else {
            cat.error("No log4j.properties in build area");
        }
    }
View Full Code Here

    /**
     * @see BuildListener#buildStarted
     */
    public void buildStarted(BuildEvent event) {
        if (initialized) {
            Category cat = Category.getInstance(Project.class.getName());
            cat.info("Build started.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Category$PrivateManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.