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

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

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

Logging介绍

暂无

代码示例

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null)
  5. exceptionType = Logging.noCause().getClass();
  6. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  7. } else if (clazz == Logging.Warning.class) {
  8. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  9. } else if (clazz == Logging.Info.class) {
  10. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  11. } else if (clazz == Logging.Debug.class) {
  12. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  13. } else
  14. throw new IllegalArgumentException("unknown LogLevel " + clazz);
  15. return filter.intercept(new AbstractFunction0<T>() {
  16. public T apply() {
  17. return run();
  18. }
  19. }, p.system());
  20. }

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

  1. /**
  2. * Constructor.
  3. *
  4. * @param capacity the capacity of the queue
  5. * @param actorSystem the actor system
  6. */
  7. public ThingUpdaterMessageQueue(final int capacity, final ActorSystem actorSystem) {
  8. log = Logging.getLogger(actorSystem, ThingUpdaterMessageQueue.class);
  9. this.capacity = capacity;
  10. }

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

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

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

  1. /**
  2. * Create a processing unit from a function.
  3. *
  4. * @param self reference to the actor carrying the pre-enforcement.
  5. * @param processor function to call.
  6. * @return Akka stream graph.
  7. */
  8. static Graph<FlowShape<WithSender, WithSender>, NotUsed> fromFunction(
  9. @Nullable final ActorRef self,
  10. final Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> processor) {
  11. final Attributes logLevels =
  12. Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(), Logging.ErrorLevel());
  13. final Flow<WithSender<WithDittoHeaders>, WithSender, NotUsed> flow =
  14. Flow.<WithSender<WithDittoHeaders>>create()
  15. .mapAsync(1, wrapped -> {
  16. final Supplier<CompletionStage<Object>> futureSupplier = () ->
  17. processor.apply(wrapped.getMessage())
  18. .<Object>thenApply(result -> WithSender.of(result, wrapped.getSender()));
  19. return handleErrorNowOrLater(futureSupplier, wrapped, self);
  20. })
  21. .log("PreEnforcer")
  22. .withAttributes(logLevels)
  23. .flatMapConcat(PreEnforcer::keepResultAndLogErrors);
  24. return Pipe.joinUnhandledSink(
  25. Pipe.joinFilteredFlow(Filter.of(WithDittoHeaders.class), flow), unhandled());
  26. }

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

  1. private Sink<Message, NotUsed> createSink(final Integer version, final String connectionCorrelationId,
  2. final AuthorizationContext connectionAuthContext, final DittoHeaders additionalHeaders,
  3. final ProtocolAdapter adapter) {
  4. return Flow.<Message>create()
  5. .filter(Message::isText)
  6. .map(Message::asTextMessage)
  7. .map(textMsg -> {
  8. if (textMsg.isStrict()) {
  9. return Source.single(textMsg.getStrictText());
  10. } else {
  11. return textMsg.getStreamedText();
  12. }
  13. })
  14. .flatMapConcat(textMsg -> textMsg.<String>fold("", (str1, str2) -> str1 + str2))
  15. .via(Flow.fromFunction(result -> {
  16. LogUtil.logWithCorrelationId(LOGGER, connectionCorrelationId, logger ->
  17. logger.debug("Received incoming WebSocket message: {}", result));
  18. return result;
  19. }))
  20. .withAttributes(Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(),
  21. Logging.WarningLevel()))
  22. .filter(strictText -> processProtocolMessage(connectionAuthContext, connectionCorrelationId,
  23. strictText))
  24. .map(buildSignal(version, connectionCorrelationId, connectionAuthContext, additionalHeaders, adapter))
  25. .to(Sink.actorSubscriber(
  26. CommandSubscriber.props(streamingActor, subscriberBackpressureQueueSize, eventStream)));
  27. }

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

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

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

  1. public ServiceRoutes(ActorSystem system, ActorRef serviceRegistryActor) {
  2. this.system = system;
  3. this.serviceRegistryActor = serviceRegistryActor;
  4. log = Logging.getLogger(system, this);
  5. }

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

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

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

  1. /**
  2. * Constructor.
  3. *
  4. * @param capacity the capacity of the queue
  5. * @param actorSystem the actor system
  6. */
  7. public ThingUpdaterMessageQueue(final int capacity, final ActorSystem actorSystem) {
  8. log = Logging.getLogger(actorSystem, ThingUpdaterMessageQueue.class);
  9. this.capacity = capacity;
  10. }

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null) exceptionType = Logging.noCause().getClass();
  5. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  6. } else if (clazz == Logging.Warning.class) {
  7. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  8. } else if (clazz == Logging.Info.class) {
  9. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  10. } else if (clazz == Logging.Debug.class) {
  11. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  12. } else throw new IllegalArgumentException("unknown LogLevel " + clazz);
  13. return filter.intercept(
  14. new AbstractFunction0<T>() {
  15. @Override
  16. public T apply() {
  17. return run();
  18. }
  19. },
  20. p.system());
  21. }

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

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

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

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

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null) exceptionType = Logging.noCause().getClass();
  5. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  6. } else if (clazz == Logging.Warning.class) {
  7. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  8. } else if (clazz == Logging.Info.class) {
  9. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  10. } else if (clazz == Logging.Debug.class) {
  11. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  12. } else throw new IllegalArgumentException("unknown LogLevel " + clazz);
  13. return filter.intercept(
  14. new AbstractFunction0<T>() {
  15. @Override
  16. public T apply() {
  17. return run();
  18. }
  19. },
  20. p.system());
  21. }

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

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

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

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

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null)
  5. exceptionType = Logging.noCause().getClass();
  6. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  7. } else if (clazz == Logging.Warning.class) {
  8. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  9. } else if (clazz == Logging.Info.class) {
  10. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  11. } else if (clazz == Logging.Debug.class) {
  12. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  13. } else
  14. throw new IllegalArgumentException("unknown LogLevel " + clazz);
  15. return filter.intercept(new AbstractFunction0<T>() {
  16. public T apply() {
  17. return run();
  18. }
  19. }, p.system());
  20. }

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

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

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null)
  5. exceptionType = Logging.noCause().getClass();
  6. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  7. } else if (clazz == Logging.Warning.class) {
  8. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  9. } else if (clazz == Logging.Info.class) {
  10. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  11. } else if (clazz == Logging.Debug.class) {
  12. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  13. } else
  14. throw new IllegalArgumentException("unknown LogLevel " + clazz);
  15. return filter.intercept(new AbstractFunction0<T>() {
  16. public T apply() {
  17. return run();
  18. }
  19. }, p.system());
  20. }

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

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

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

  1. public T exec() {
  2. akka.testkit.EventFilter filter;
  3. if (clazz == Logging.Error.class) {
  4. if (exceptionType == null)
  5. exceptionType = Logging.noCause().getClass();
  6. filter = new ErrorFilter(exceptionType, source, message, pattern, complete, occurrences);
  7. } else if (clazz == Logging.Warning.class) {
  8. filter = new WarningFilter(source, message, pattern, complete, occurrences);
  9. } else if (clazz == Logging.Info.class) {
  10. filter = new InfoFilter(source, message, pattern, complete, occurrences);
  11. } else if (clazz == Logging.Debug.class) {
  12. filter = new DebugFilter(source, message, pattern, complete, occurrences);
  13. } else
  14. throw new IllegalArgumentException("unknown LogLevel " + clazz);
  15. return filter.intercept(new AbstractFunction0<T>() {
  16. public T apply() {
  17. return run();
  18. }
  19. }, p.system());
  20. }

相关文章