Package org.slf4j

Examples of org.slf4j.Marker


public class MarkerConverter extends ClassicConverter {

  private static String EMPTY = "";

  public String convert(ILoggingEvent le) {
    Marker marker = le.getMarker();
    if (marker == null) {
      return EMPTY;
    } else {
      return marker.toString();
    }
  }
View Full Code Here


      if (i == 3)  {
        MDC.put("username", "sebastien");
        logger.debug("logging statement " + i);
        MDC.remove("username");
      } else if (i == 6) {
        Marker billing = MarkerFactory.getMarker("billing");
        logger.error(billing, "billing statement " + i);
      } else {
        logger.info("logging statement " + i);
      }
    }
View Full Code Here

        if (dqFact.getWww() != null) {
          logger.warn(ConversionContext.getContext(), "www ({}) was ignored.", dqFact.getWww());
        }

        if (dqFact.getUid() != null) {
          Marker uidContext = ConversionContext.getDetachedMarker(dqFact.getUidTag());
          ConversionContext.addReference(uidContext);
          logger.warn(ConversionContext.getContext(), "UID ({}) was ignored.", dqFact.getUid());
          ConversionContext.removeReference(uidContext);
        }
View Full Code Here

  public void toPerson(org.folg.gedcom.model.Person dqPerson, GedcomxConversionResult result) throws IOException {
    if (dqPerson == null) {
      return;
    }

    Marker personContext = ConversionContext.getDetachedMarker(String.format("@%s@ INDI", dqPerson.getId()));
    ConversionContext.addReference(personContext);
    try {
      Person gedxPerson = new Person();
      gedxPerson.setId(dqPerson.getId());

      //////////////////////////////////////////////////////////////////////
      // Process NAMES

      int index = 0;
      List<Name> gedxNames = new ArrayList<Name>();
      for (org.folg.gedcom.model.Name dqName : dqPerson.getNames()) {
        Marker nameContext = ConversionContext.getDetachedMarker("NAME." + (++index));
        ConversionContext.addReference(nameContext);
        try {
          int cntNamesBeforeThisNameObj = gedxNames.size();
          gedxNames.addAll(toNameList(dqName, result));
          if ((cntNamesBeforeThisNameObj == 0) && (gedxNames.size() > 0)) {
            // the first name encountered is assumed to be the preferred name per the recommendation given in the GEDCOM 5.5.1 specification
            gedxNames.get(0).setPreferred(Boolean.TRUE);
          }
        } finally {
          ConversionContext.removeReference(nameContext);
        }
      }

      if (gedxNames.size() > 0) {
        gedxPerson.setNames(gedxNames);
      }


      //////////////////////////////////////////////////////////////////////
      // Process facts

      processFacts(gedxPerson, dqPerson.getEventsFacts(), result);


      //////////////////////////////////////////////////////////////////////
      // Process sources

      List<SourceReference> sources = CommonMapper.toSourcesAndSourceReferences(dqPerson.getSourceCitations(), result);
      gedxPerson.setSources(sources);


      //////////////////////////////////////////////////////////////////////
      // Add the person to the conversion results
      java.util.Date lastModified = CommonMapper.toDate(dqPerson.getChange()); //todo: set the timestamp on the attribution?


      //////////////////////////////////////////////////////////////////////
      // Warn about all fields we are not processing

      if (dqPerson.getAssociations() != null && dqPerson.getAssociations().size() > 0) {
        logger.warn(ConversionContext.getContext(), "Associations ignored.");
      }
      if (dqPerson.getRecordFileNumber() != null) {
        logger.warn(ConversionContext.getContext(), "Record file number ignored: {}", dqPerson.getRecordFileNumber());
      }
      if (dqPerson.getReferenceNumbers() != null && dqPerson.getReferenceNumbers().size() > 0) {
        logger.warn(ConversionContext.getContext(), "Reference numbers ignored.");
      }

      if (dqPerson.getAncestorInterestSubmitterRef() != null) {
        logger.warn(ConversionContext.getContext(), "Ancestor interest ignored: {}.", dqPerson.getAncestorInterestSubmitterRef());
      }

      if (dqPerson.getDescendantInterestSubmitterRef() != null) {
        logger.warn(ConversionContext.getContext(), "Descendant interest ignored: {}.", dqPerson.getDescendantInterestSubmitterRef());
      }

      int cntLdsOrdinances = dqPerson.getLdsOrdinances().size();
      if (cntLdsOrdinances > 0) {
        logger.warn(ConversionContext.getContext(), "Did not process information for {} LDS ordinances.", cntLdsOrdinances);
      }

      if (dqPerson.getAddress() != null) {
        logger.warn(ConversionContext.getContext(), "Address was ignored: {}", dqPerson.getAddress().getDisplayValue());
      }

      if (dqPerson.getEmail() != null) {
        logger.warn(ConversionContext.getContext(), "e-mail ({}) was ignored.", dqPerson.getEmail());
      }
      if (dqPerson.getFax() != null) {
        logger.warn(ConversionContext.getContext(), "fax ({}) was ignored.", dqPerson.getFax());
      }
      if (dqPerson.getPhone() != null) {
        logger.warn(ConversionContext.getContext(), "phone ({}) was ignored.", dqPerson.getPhone());
      }
      if (dqPerson.getWww() != null) {
        logger.warn(ConversionContext.getContext(), "www ({}) was ignored.", dqPerson.getWww());
      }

      if (dqPerson.getUid() != null) {
        Marker uidContext = ConversionContext.getDetachedMarker(dqPerson.getUidTag());
        ConversionContext.addReference(uidContext);
        logger.warn(ConversionContext.getContext(), "UID ({}) was ignored.", dqPerson.getUid());
        ConversionContext.removeReference(uidContext);
      }
View Full Code Here

      return;
    }

    int index = 0;
    for(EventFact fact : facts) {
      Marker factContext = ConversionContext.getDetachedMarker(fact.getTag() + '.' + (++index));
      ConversionContext.addReference(factContext);
      try {
        Fact gedxFact = FactMapper.toFact(fact, result);

        if(gedxFact == null) {
View Full Code Here

      List<SourceReference> sources = CommonMapper.toSourcesAndSourceReferences(dqName.getSourceCitations(), result);
      gedxName.setSources(sources);
    }

    if ((dqName.getType() != null) && (dqName.getType().trim().length() > 0)) {
      Marker nameTypeContext = ConversionContext.getDetachedMarker((dqName.getTypeTag() == null)?"Undetermined":dqName.getTypeTag());
      ConversionContext.addReference(nameTypeContext);
      logger.warn(ConversionContext.getContext(), "Name type ({}) was ignored.", dqName.getType());
      //gedxName.setKnownType();
      //gedxName.setType();
      ConversionContext.removeReference(nameTypeContext);
View Full Code Here

    /**
     * Stream command output as log message for easy debugging
     */
    public static void logCommandOutput(Logger logger, String instanceId, Session.Command command) {
        final Marker marker = MarkerFactory.getMarker("ssh-" + instanceId);

        new InfoStreamLogger(command.getInputStream(), logger, marker)
            .start();
        new ErrorStreamLogger(command.getErrorStream(), logger, marker)
            .start();
View Full Code Here

  public synchronized Marker getMarker(String name) {
    if (name == null) {
      throw new IllegalArgumentException("Marker name cannot be null");
    }

    Marker marker = (Marker) markerMap.get(name);
    if (marker == null) {
      marker = new BasicMarker(name);
      markerMap.put(name, marker);
    }
    return marker;
View Full Code Here

      return false;
    }

    int size = children.size();
    for (int i = 0; i < size; i++) {
      Marker m = (Marker) children.get(i);
      if( m == markerToRemove) {
          return false;
      }
    }
    // could not find markerToRemove
View Full Code Here

      return true;
    }
   
    if (hasChildren()) {
      for(int i = 0; i < children.size(); i++) {
        Marker child = (Marker) children.get(i);
        if(child.contains(other)) {
          return true;
        }
      }
    }
    return false;
View Full Code Here

TOP

Related Classes of org.slf4j.Marker

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.