Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


      this.type = type;
    }

    public
    String convert(LoggingEvent event) {
      LocationInfo locationInfo = event.getLocationInformation();
      switch(type) {
      case FULL_LOCATION_CONVERTER:
  return locationInfo.fullInfo;
      case METHOD_LOCATION_CONVERTER:
  return locationInfo.getMethodName();
      case LINE_LOCATION_CONVERTER:
  return locationInfo.getLineNumber();
      case FILE_LOCATION_CONVERTER:
  return locationInfo.getFileName();
      default: return null;
      }
    }
View Full Code Here


   
    /**
     * testLocationInfo
     */
    public void testLocationInfo() throws Exception {
        LocationInfo expected = this.origEvent.getLocationInformation();
        assertNotNull(expected);
       
        LocationInfo actual = this.fastEvent.getLocationInformation();
        assertNotNull(actual);
        System.err.println(this.fastEvent.getLocationInformation());
       
        assertEquals(expected.getLineNumber(), actual.getLineNumber());
        assertEquals(expected.getFileName(), actual.getFileName());
        assertEquals(expected.getClassName(), actual.getClassName());
        assertEquals(expected.getMethodName(), actual.getMethodName());
    }
View Full Code Here

        String lineNum = "1958";
        String msg = "Dispatching 1 messages and waiting for the results for InsertCallForwarding #1024611756678316032/0";
        logger.info(String.format("%s:%s %s", fileName, lineNum, msg));
        assertNotNull(fastEvent);
       
        LocationInfo actual = this.fastEvent.getLocationInformation();
        assertNotNull(actual);
        assertEquals(fileName, actual.getFileName());
        assertEquals(lineNum, actual.getLineNumber());
        assertEquals(msg, fastEvent.getMessage());
    }
View Full Code Here

          insertStatement.setString(5, event.getLevel().toString());
          insertStatement.setString(6, event.getNDC());
          insertStatement.setString(7, event.getThreadName());
          insertStatement.setShort(8, DBHelper.computeReferenceMask(event));
         
          LocationInfo li;
         
          if (event.locationInformationExists() || locationInfo) {
              li = event.getLocationInformation();
          } else {
              li = LocationInfo.NA_LOCATION_INFO;
          }
         
          insertStatement.setString(9, li.getFileName());
          insertStatement.setString(10, li.getClassName());
          insertStatement.setString(11, li.getMethodName());
          insertStatement.setString(12, li.getLineNumber());
         
          int updateCount = insertStatement.executeUpdate();
          if (updateCount != 1) {
              LogLog.warn("Failed to insert loggingEvent");
          }
View Full Code Here

              //
              //     location info unless suppressed
              //
              //
              if (locationInfo) {
                LocationInfo locationInfo = event.getLocationInformation();
                attrs.addAttribute(null, "class", "class", "CDATA",
                        locationInfo.getClassName());
                attrs.addAttribute(null, "method", "method", "CDATA",
                          locationInfo.getMethodName());
                attrs.addAttribute(null, "file", "file", "CDATA",
                            locationInfo.getFileName());
                attrs.addAttribute(null, "line", "line", "CDATA",
                            locationInfo.getLineNumber());
                transformer.startElement(LOG4J_NS, "locationInfo",
                        "locationInfo", attrs);
                transformer.endElement(LOG4J_NS, "locationInfo",
                        "locationInfo");
              }
View Full Code Here

                    }

                    Level levelImpl = Level.toLevel(level);


          LocationInfo locationInfo = new LocationInfo(fileName,
                              className, methodName, lineNumber);
 
          ThrowableInformation throwableInfo =  new ThrowableInformation(
                                throwable);
 
View Full Code Here

        fileName = rs.getString(9);
        className = rs.getString(10);
        methodName = rs.getString(11);
        lineNumber = rs.getString(12).trim();

    LocationInfo locationInfo = null;
        if (fileName.equals(LocationInfo.NA)) {
          locationInfo = LocationInfo.NA_LOCATION_INFO;
        } else {
          locationInfo = new LocationInfo(fileName, className,
              methodName, lineNumber);
        }

        long id = rs.getLong(13);
        //LogLog.info("Received event with id=" + id);
View Full Code Here

    properties.put(Constants.RECEIVER_NAME_KEY, getName());

    //all remaining entries in fieldmap are properties
    properties.putAll(fieldMap);

    LocationInfo info = null;

    if ((eventFileName != null) || (className != null) || (methodName != null)
        || (lineNumber != null)) {
      info = new LocationInfo(eventFileName, className, methodName, lineNumber);
    } else {
      info = LocationInfo.NA_LOCATION_INFO;
    }

    LoggingEvent event = new LoggingEvent(null,
View Full Code Here

                  properties.put(e.getKey(), e.getValue());
              }
          }
      }

      LocationInfo info;
      if ((fileName != null)
              || (className != null)
              || (methodName != null)
              || (lineNumber != null)) {
          info = new LocationInfo(fileName, className, methodName, lineNumber);
      } else {
        info = LocationInfo.NA_LOCATION_INFO;
      }
      ThrowableInformation throwableInfo = null;
      if (exception != null) {
View Full Code Here

                Map.Entry e = (Map.Entry) i.next();
                properties.put(e.getKey(), e.getValue());
            }
        }

      LocationInfo info;
      if ((fileName != null)
              || (className != null)
              || (methodName != null)
              || (lineNumber != null)) {
          info = new LocationInfo(fileName, className, methodName, lineNumber);
      } else {
        info = LocationInfo.NA_LOCATION_INFO;
      }

        ThrowableInformation throwableInfo = null;
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.LocationInfo

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.