reactor.util.Logger.trace()方法的使用及代码示例

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

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

Logger.trace介绍

[英]Log a message at the TRACE level.
[中]在跟踪级别记录消息。

代码示例

代码示例来源:origin: reactor/reactor-core

  1. @Override
  2. public void trace(String msg, Throwable t) {
  3. delegate.trace(msg, t);
  4. }

代码示例来源:origin: reactor/reactor-core

  1. @Override
  2. public void trace(String msg) {
  3. delegate.trace(msg);
  4. }

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

  1. @Override
  2. public void onSubscribe(Subscription subscription) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("On subscribe");
  5. }
  6. this.s = subscription;
  7. try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
  8. if (log.isTraceEnabled()) {
  9. log.trace("On subscribe - span continued");
  10. }
  11. this.subscriber.onSubscribe(this);
  12. }
  13. }

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

  1. @Override
  2. public void request(long n) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("Request");
  5. }
  6. try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
  7. if (log.isTraceEnabled()) {
  8. log.trace("Request - continued");
  9. }
  10. this.s.request(n);
  11. // no additional cleaning is required cause we operate on scopes
  12. if (log.isTraceEnabled()) {
  13. log.trace("Request after cleaning. Current span [{}]",
  14. this.tracer.currentSpan());
  15. }
  16. }
  17. }

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

  1. void cleanup() {
  2. if (compareAndSet(false, true)) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("Cleaning up");
  5. }
  6. this.span.finish();
  7. if (log.isTraceEnabled()) {
  8. log.trace("Span closed");
  9. }
  10. if (this.rootSpan != null) {
  11. this.rootSpan.finish();
  12. if (log.isTraceEnabled()) {
  13. log.trace("Closed root span");
  14. }
  15. }
  16. }
  17. }

代码示例来源:origin: reactor/reactor-core

  1. @Override
  2. public void trace(String format, Object... arguments) {
  3. delegate.trace(format, wrapArguments(arguments));
  4. }

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

  1. @Override
  2. public void cancel() {
  3. try {
  4. if (log.isTraceEnabled()) {
  5. log.trace("Cancel");
  6. }
  7. this.s.cancel();
  8. }
  9. finally {
  10. cleanup();
  11. }
  12. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void trace1() throws Exception {
  3. logger.trace("message {} {} format", "with", 1);
  4. assertThat(errContent.size()).isZero();
  5. assertThat(outContent.toString()).isEqualTo("[TRACE] (" + Thread.currentThread().getName() + ") message with 1 format\n");
  6. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void trace() throws Exception {
  3. logger.trace("message");
  4. assertThat(errContent.size()).isZero();
  5. assertThat(outContent.toString()).isEqualTo("[TRACE] (" + Thread.currentThread().getName() + ") message\n");
  6. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void traceDismissedInNonVerboseMode() {
  3. Logger log = new Loggers.ConsoleLogger("test", new PrintStream(outContent), new PrintStream(errContent), false);
  4. log.trace("foo");
  5. log.trace("foo", new IllegalArgumentException("foo"));
  6. log.trace("foo {}", "foo");
  7. assertThat(outContent.toString()).doesNotContain("foo");
  8. assertThat(errContent.toString()).doesNotContain("foo");
  9. assertThat(log.isTraceEnabled()).as("isTraceEnabled").isFalse();
  10. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void traceNulls() {
  3. logger.trace("vararg {} is {}", (Object[]) null);
  4. logger.trace("param {} is {}", null, null);
  5. assertThat(errContent.size()).isZero();
  6. assertThat(outContent.toString())
  7. .contains("vararg {} is {}")
  8. .contains("param null is null");
  9. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void trace2() throws Exception {
  3. logger.trace("with cause", CAUSE);
  4. assertThat(errContent.size()).isZero();
  5. assertThat(outContent.toString())
  6. .startsWith("[TRACE] (" + Thread.currentThread().getName() + ") with cause - java.lang.IllegalStateException: cause" +
  7. "\njava.lang.IllegalStateException: cause\n" +
  8. "\tat reactor.util.ConsoleLoggerTest");
  9. }

代码示例来源:origin: reactor/reactor-core

  1. @Test
  2. public void logErrorUsesTraceWhenFinest() {
  3. Level level = Level.FINEST;
  4. demonstrateLogError(); //added to the test suite so that sanity check can be done
  5. Mono<String> source = Mono.error(new IllegalStateException("ignored"));
  6. Logger mockLogger = Mockito.mock(Logger.class);
  7. when(mockLogger.isErrorEnabled()).thenReturn(true);
  8. when(mockLogger.isDebugEnabled()).thenReturn(true);
  9. when(mockLogger.isTraceEnabled()).thenReturn(true);
  10. SignalLogger<String> sl = new SignalLogger<>(source, null, level,
  11. false, s -> mockLogger);
  12. sl.onErrorCall().accept(new IllegalStateException("boom"));
  13. verify(mockLogger, never()).isErrorEnabled();
  14. verify(mockLogger, never()).isDebugEnabled();
  15. verify(mockLogger, times(1)).isTraceEnabled();
  16. verify(mockLogger, times(1)).trace(Mockito.anyString(), (Object[]) Mockito.any());
  17. verify(mockLogger, times(1)).trace(Mockito.anyString(), (Throwable) Mockito.any());
  18. verifyNoMoreInteractions(mockLogger);
  19. }

代码示例来源:origin: reactor/reactor-core

  1. /**
  2. * Structured logging with level adaptation and operator ascii graph if required.
  3. *
  4. * @param signalType the type of signal being logged
  5. * @param signalValue the value for the signal (use empty string if not required)
  6. */
  7. void log(SignalType signalType, Object signalValue) {
  8. String line = fuseable ? LOG_TEMPLATE_FUSEABLE : LOG_TEMPLATE;
  9. if (operatorLine != null) {
  10. line = line + " " + operatorLine;
  11. }
  12. if (level == Level.FINEST) {
  13. log.trace(line, signalType, signalValue);
  14. }
  15. else if (level == Level.FINE) {
  16. log.debug(line, signalType, signalValue);
  17. }
  18. else if (level == Level.INFO) {
  19. log.info(line, signalType, signalValue);
  20. }
  21. else if (level == Level.WARNING) {
  22. log.warn(line, signalType, signalValue);
  23. }
  24. else if (level == Level.SEVERE) {
  25. log.error(line, signalType, signalValue);
  26. }
  27. }

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

  1. SpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing,
  2. String name) {
  3. this.subscriber = subscriber;
  4. this.tracer = tracing.tracer();
  5. Span root = ctx.getOrDefault(Span.class, this.tracer.currentSpan());
  6. if (log.isTraceEnabled()) {
  7. log.trace("Span from context [{}]", root);
  8. }
  9. this.rootSpan = root;
  10. if (log.isTraceEnabled()) {
  11. log.trace("Stored context root span [{}]", this.rootSpan);
  12. }
  13. this.span = root != null ? this.tracer
  14. .nextSpan(TraceContextOrSamplingFlags.create(root.context())).name(name)
  15. : this.tracer.nextSpan().name(name);
  16. if (log.isTraceEnabled()) {
  17. log.trace("Created span [{}], with name [{}]", this.span, name);
  18. }
  19. this.context = ctx.put(Span.class, this.span);
  20. }

代码示例来源:origin: reactor/reactor-core

  1. if (shouldLogAsTrace) {
  2. return e -> {
  3. log.trace(s, SignalType.ON_ERROR, e, source);
  4. log.trace("", e);
  5. };

代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core

  1. @Override
  2. public void onSubscribe(Subscription subscription) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("On subscribe");
  5. }
  6. this.s = subscription;
  7. try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
  8. if (log.isTraceEnabled()) {
  9. log.trace("On subscribe - span continued");
  10. }
  11. this.subscriber.onSubscribe(this);
  12. }
  13. }

代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core

  1. @Override
  2. public void cancel() {
  3. try {
  4. if (log.isTraceEnabled()) {
  5. log.trace("Cancel");
  6. }
  7. this.s.cancel();
  8. }
  9. finally {
  10. cleanup();
  11. }
  12. }

代码示例来源:origin: reactor/reactor-netty

  1. @Override
  2. final public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
  3. if (log.isTraceEnabled()) {
  4. log.trace(format(ctx.channel(), "End of the pipeline, User event {}"), evt);
  5. }
  6. if (evt instanceof NettyPipeline.SendOptionsChangeEvent) {
  7. if (log.isDebugEnabled()) {
  8. log.debug(format(ctx.channel(), "New sending options"));
  9. }
  10. ((NettyPipeline.SendOptionsChangeEvent) evt).configurator()
  11. .accept(this);
  12. return;
  13. }
  14. ctx.fireUserEventTriggered(evt);
  15. }

代码示例来源:origin: io.rsocket.rpc/rsocket-rpc-core

  1. @Override
  2. public void cancel() {
  3. try (Scope scope = this.tracer.scopeManager().activate(span, false)) {
  4. scope.span().log(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()), "cancel");
  5. if (log.isTraceEnabled()) {
  6. log.trace("Cancel");
  7. }
  8. this.s.cancel();
  9. } finally {
  10. cleanup();
  11. }
  12. }

相关文章