akka.event.Logging类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中akka.event.Logging类的一些代码示例,展示了Logging类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logging类的具体详情如下:
包路径:akka.event.Logging
类名称:Logging

Logging介绍

暂无

代码示例

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null)
   exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else
  throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(new AbstractFunction0<T>() {
  public T apply() {
   return run();
  }
 }, p.system());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-updater-actors

/**
 * Constructor.
 *
 * @param capacity the capacity of the queue
 * @param actorSystem the actor system
 */
public ThingUpdaterMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, ThingUpdaterMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: com.lightbend.lagom/lagom-javadsl-persistence

/**
   * The name of this read side.
   *
   * This name should be unique among the read sides and entity types of the service. By default it is using the
   * short class name of the concrete `ReadSideProcessor` class. Subclasses may override to define other type names.
   * It is wise to override and retain the original name when the class name is changed because this name is used to
   * identify read sides throughout the cluster.
   */
  public String readSideName() {
    return Logging.simpleName(getClass());
  }
}

代码示例来源:origin: eclipse/ditto

/**
 * Create a processing unit from a function.
 *
 * @param self reference to the actor carrying the pre-enforcement.
 * @param processor function to call.
 * @return Akka stream graph.
 */
static Graph<FlowShape<WithSender, WithSender>, NotUsed> fromFunction(
    @Nullable final ActorRef self,
    final Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> processor) {
  final Attributes logLevels =
      Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(), Logging.ErrorLevel());
  final Flow<WithSender<WithDittoHeaders>, WithSender, NotUsed> flow =
      Flow.<WithSender<WithDittoHeaders>>create()
          .mapAsync(1, wrapped -> {
            final Supplier<CompletionStage<Object>> futureSupplier = () ->
                processor.apply(wrapped.getMessage())
                    .<Object>thenApply(result -> WithSender.of(result, wrapped.getSender()));
            return handleErrorNowOrLater(futureSupplier, wrapped, self);
          })
          .log("PreEnforcer")
          .withAttributes(logLevels)
          .flatMapConcat(PreEnforcer::keepResultAndLogErrors);
  return Pipe.joinUnhandledSink(
      Pipe.joinFilteredFlow(Filter.of(WithDittoHeaders.class), flow), unhandled());
}

代码示例来源:origin: eclipse/ditto

private Sink<Message, NotUsed> createSink(final Integer version, final String connectionCorrelationId,
    final AuthorizationContext connectionAuthContext, final DittoHeaders additionalHeaders,
    final ProtocolAdapter adapter) {
  return Flow.<Message>create()
      .filter(Message::isText)
      .map(Message::asTextMessage)
      .map(textMsg -> {
        if (textMsg.isStrict()) {
          return Source.single(textMsg.getStrictText());
        } else {
          return textMsg.getStreamedText();
        }
      })
      .flatMapConcat(textMsg -> textMsg.<String>fold("", (str1, str2) -> str1 + str2))
      .via(Flow.fromFunction(result -> {
        LogUtil.logWithCorrelationId(LOGGER, connectionCorrelationId, logger ->
            logger.debug("Received incoming WebSocket message: {}", result));
        return result;
      }))
      .withAttributes(Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(),
          Logging.WarningLevel()))
      .filter(strictText -> processProtocolMessage(connectionAuthContext, connectionCorrelationId,
          strictText))
      .map(buildSignal(version, connectionCorrelationId, connectionAuthContext, additionalHeaders, adapter))
      .to(Sink.actorSubscriber(
          CommandSubscriber.props(streamingActor, subscriberBackpressureQueueSize, eventStream)));
}

代码示例来源:origin: opendaylight/controller

@Test
public void testOnReceiveAnother() throws Exception {
  final Address local = Address.apply("http", "local");
  final Address remote = Address.apply("http", "remote");
  final Throwable t = new RuntimeException("Another exception");
  final InvalidAssociation cause = InvalidAssociation.apply(local, remote, t, Option.apply(null));
  final AssociationErrorEvent event = new AssociationErrorEvent(cause, local, remote, true, Logging.ErrorLevel());
  actor.tell(event, ActorRef.noSender());
  verify(callback, never()).apply();
}

代码示例来源:origin: zhihuili/flower

public ServiceRoutes(ActorSystem system, ActorRef serviceRegistryActor) {
  this.system = system;
  this.serviceRegistryActor = serviceRegistryActor;
  log = Logging.getLogger(system, this);
}

代码示例来源:origin: com.typesafe.akka/akka-http

final ActorSystem theSystem = system.orElseGet(() -> ActorSystem.create(Logging.simpleName(this).replaceAll("\\$", "")));
systemReference.set(theSystem);
final ActorMaterializer materializer = ActorMaterializer.create(theSystem);

代码示例来源:origin: eclipse/ditto

/**
 * Constructor.
 *
 * @param capacity the capacity of the queue
 * @param actorSystem the actor system
 */
public ThingUpdaterMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, ThingUpdaterMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null) exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(
   new AbstractFunction0<T>() {
    @Override
    public T apply() {
     return run();
    }
   },
   p.system());
}

代码示例来源:origin: com.typesafe.akka/akka-http_2.11

final ActorSystem theSystem = system.orElseGet(() -> ActorSystem.create(Logging.simpleName(this).replaceAll("\\$", "")));
systemReference.set(theSystem);
final ActorMaterializer materializer = ActorMaterializer.create(theSystem);

代码示例来源:origin: org.eclipse.ditto/ditto-services-policies-persistence

PolicyPersistenceActorMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, PolicyPersistenceActorMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.12

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null) exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(
   new AbstractFunction0<T>() {
    @Override
    public T apply() {
     return run();
    }
   },
   p.system());
}

代码示例来源:origin: com.typesafe.akka/akka-http_2.12

final ActorSystem theSystem = system.orElseGet(() -> ActorSystem.create(Logging.simpleName(this).replaceAll("\\$", "")));
systemReference.set(theSystem);
final ActorMaterializer materializer = ActorMaterializer.create(theSystem);

代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence

public ThingPersistenceActorMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, ThingPersistenceActorMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: com.data-artisans/flakka-testkit

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null)
   exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else
  throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(new AbstractFunction0<T>() {
  public T apply() {
   return run();
  }
 }, p.system());
}

代码示例来源:origin: eclipse/ditto

PolicyPersistenceActorMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, PolicyPersistenceActorMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: com.data-artisans/flakka-testkit_2.11

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null)
   exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else
  throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(new AbstractFunction0<T>() {
  public T apply() {
   return run();
  }
 }, p.system());
}

代码示例来源:origin: eclipse/ditto

public ThingPersistenceActorMessageQueue(final int capacity, final ActorSystem actorSystem) {
  log = Logging.getLogger(actorSystem, ThingPersistenceActorMessageQueue.class);
  this.capacity = capacity;
}

代码示例来源:origin: org.spark-project.akka/akka-testkit

public T exec() {
 akka.testkit.EventFilter filter;
 if (clazz == Logging.Error.class) {
  if (exceptionType == null)
   exceptionType = Logging.noCause().getClass();
  filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Warning.class) {
  filter = new WarningFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Info.class) {
  filter = new InfoFilter(source, message, pattern, complete, occurrences);
 } else if (clazz == Logging.Debug.class) {
  filter = new DebugFilter(source, message, pattern, complete, occurrences);
 } else
  throw new IllegalArgumentException("unknown LogLevel " + clazz);
 return filter.intercept(new AbstractFunction0<T>() {
  public T apply() {
   return run();
  }
 }, p.system());
}

相关文章