本文整理了Java中reactor.util.Logger.trace()
方法的一些代码示例,展示了Logger.trace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.trace()
方法的具体详情如下:
包路径:reactor.util.Logger
类名称:Logger
方法名:trace
[英]Log a message at the TRACE level.
[中]在跟踪级别记录消息。
代码示例来源:origin: reactor/reactor-core
@Override
public void trace(String msg, Throwable t) {
delegate.trace(msg, t);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void trace(String msg) {
delegate.trace(msg);
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
@Override
public void onSubscribe(Subscription subscription) {
if (log.isTraceEnabled()) {
log.trace("On subscribe");
}
this.s = subscription;
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
if (log.isTraceEnabled()) {
log.trace("On subscribe - span continued");
}
this.subscriber.onSubscribe(this);
}
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
@Override
public void request(long n) {
if (log.isTraceEnabled()) {
log.trace("Request");
}
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
if (log.isTraceEnabled()) {
log.trace("Request - continued");
}
this.s.request(n);
// no additional cleaning is required cause we operate on scopes
if (log.isTraceEnabled()) {
log.trace("Request after cleaning. Current span [{}]",
this.tracer.currentSpan());
}
}
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
void cleanup() {
if (compareAndSet(false, true)) {
if (log.isTraceEnabled()) {
log.trace("Cleaning up");
}
this.span.finish();
if (log.isTraceEnabled()) {
log.trace("Span closed");
}
if (this.rootSpan != null) {
this.rootSpan.finish();
if (log.isTraceEnabled()) {
log.trace("Closed root span");
}
}
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void trace(String format, Object... arguments) {
delegate.trace(format, wrapArguments(arguments));
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
@Override
public void cancel() {
try {
if (log.isTraceEnabled()) {
log.trace("Cancel");
}
this.s.cancel();
}
finally {
cleanup();
}
}
代码示例来源:origin: reactor/reactor-core
@Test
public void trace1() throws Exception {
logger.trace("message {} {} format", "with", 1);
assertThat(errContent.size()).isZero();
assertThat(outContent.toString()).isEqualTo("[TRACE] (" + Thread.currentThread().getName() + ") message with 1 format\n");
}
代码示例来源:origin: reactor/reactor-core
@Test
public void trace() throws Exception {
logger.trace("message");
assertThat(errContent.size()).isZero();
assertThat(outContent.toString()).isEqualTo("[TRACE] (" + Thread.currentThread().getName() + ") message\n");
}
代码示例来源:origin: reactor/reactor-core
@Test
public void traceDismissedInNonVerboseMode() {
Logger log = new Loggers.ConsoleLogger("test", new PrintStream(outContent), new PrintStream(errContent), false);
log.trace("foo");
log.trace("foo", new IllegalArgumentException("foo"));
log.trace("foo {}", "foo");
assertThat(outContent.toString()).doesNotContain("foo");
assertThat(errContent.toString()).doesNotContain("foo");
assertThat(log.isTraceEnabled()).as("isTraceEnabled").isFalse();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void traceNulls() {
logger.trace("vararg {} is {}", (Object[]) null);
logger.trace("param {} is {}", null, null);
assertThat(errContent.size()).isZero();
assertThat(outContent.toString())
.contains("vararg {} is {}")
.contains("param null is null");
}
代码示例来源:origin: reactor/reactor-core
@Test
public void trace2() throws Exception {
logger.trace("with cause", CAUSE);
assertThat(errContent.size()).isZero();
assertThat(outContent.toString())
.startsWith("[TRACE] (" + Thread.currentThread().getName() + ") with cause - java.lang.IllegalStateException: cause" +
"\njava.lang.IllegalStateException: cause\n" +
"\tat reactor.util.ConsoleLoggerTest");
}
代码示例来源:origin: reactor/reactor-core
@Test
public void logErrorUsesTraceWhenFinest() {
Level level = Level.FINEST;
demonstrateLogError(); //added to the test suite so that sanity check can be done
Mono<String> source = Mono.error(new IllegalStateException("ignored"));
Logger mockLogger = Mockito.mock(Logger.class);
when(mockLogger.isErrorEnabled()).thenReturn(true);
when(mockLogger.isDebugEnabled()).thenReturn(true);
when(mockLogger.isTraceEnabled()).thenReturn(true);
SignalLogger<String> sl = new SignalLogger<>(source, null, level,
false, s -> mockLogger);
sl.onErrorCall().accept(new IllegalStateException("boom"));
verify(mockLogger, never()).isErrorEnabled();
verify(mockLogger, never()).isDebugEnabled();
verify(mockLogger, times(1)).isTraceEnabled();
verify(mockLogger, times(1)).trace(Mockito.anyString(), (Object[]) Mockito.any());
verify(mockLogger, times(1)).trace(Mockito.anyString(), (Throwable) Mockito.any());
verifyNoMoreInteractions(mockLogger);
}
代码示例来源:origin: reactor/reactor-core
/**
* Structured logging with level adaptation and operator ascii graph if required.
*
* @param signalType the type of signal being logged
* @param signalValue the value for the signal (use empty string if not required)
*/
void log(SignalType signalType, Object signalValue) {
String line = fuseable ? LOG_TEMPLATE_FUSEABLE : LOG_TEMPLATE;
if (operatorLine != null) {
line = line + " " + operatorLine;
}
if (level == Level.FINEST) {
log.trace(line, signalType, signalValue);
}
else if (level == Level.FINE) {
log.debug(line, signalType, signalValue);
}
else if (level == Level.INFO) {
log.info(line, signalType, signalValue);
}
else if (level == Level.WARNING) {
log.warn(line, signalType, signalValue);
}
else if (level == Level.SEVERE) {
log.error(line, signalType, signalValue);
}
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
SpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing,
String name) {
this.subscriber = subscriber;
this.tracer = tracing.tracer();
Span root = ctx.getOrDefault(Span.class, this.tracer.currentSpan());
if (log.isTraceEnabled()) {
log.trace("Span from context [{}]", root);
}
this.rootSpan = root;
if (log.isTraceEnabled()) {
log.trace("Stored context root span [{}]", this.rootSpan);
}
this.span = root != null ? this.tracer
.nextSpan(TraceContextOrSamplingFlags.create(root.context())).name(name)
: this.tracer.nextSpan().name(name);
if (log.isTraceEnabled()) {
log.trace("Created span [{}], with name [{}]", this.span, name);
}
this.context = ctx.put(Span.class, this.span);
}
代码示例来源:origin: reactor/reactor-core
if (shouldLogAsTrace) {
return e -> {
log.trace(s, SignalType.ON_ERROR, e, source);
log.trace("", e);
};
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core
@Override
public void onSubscribe(Subscription subscription) {
if (log.isTraceEnabled()) {
log.trace("On subscribe");
}
this.s = subscription;
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(this.span)) {
if (log.isTraceEnabled()) {
log.trace("On subscribe - span continued");
}
this.subscriber.onSubscribe(this);
}
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core
@Override
public void cancel() {
try {
if (log.isTraceEnabled()) {
log.trace("Cancel");
}
this.s.cancel();
}
finally {
cleanup();
}
}
代码示例来源:origin: reactor/reactor-netty
@Override
final public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (log.isTraceEnabled()) {
log.trace(format(ctx.channel(), "End of the pipeline, User event {}"), evt);
}
if (evt instanceof NettyPipeline.SendOptionsChangeEvent) {
if (log.isDebugEnabled()) {
log.debug(format(ctx.channel(), "New sending options"));
}
((NettyPipeline.SendOptionsChangeEvent) evt).configurator()
.accept(this);
return;
}
ctx.fireUserEventTriggered(evt);
}
代码示例来源:origin: io.rsocket.rpc/rsocket-rpc-core
@Override
public void cancel() {
try (Scope scope = this.tracer.scopeManager().activate(span, false)) {
scope.span().log(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()), "cancel");
if (log.isTraceEnabled()) {
log.trace("Cancel");
}
this.s.cancel();
} finally {
cleanup();
}
}
内容来源于网络,如有侵权,请联系作者删除!