Skip to content

Commit f36174e

Browse files
committed
Add timestamp to beginning/ending messages
1 parent 6419ace commit f36174e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/commonjava/util/gateway/util/WebClientAdapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,10 @@ public Uni<Response> enqueue()
313313

314314
Call call = callClient.newCall( requestBuilder.build() );
315315

316+
final String timestamp = System.currentTimeMillis() + "." + System.nanoTime(); // to identify the beginning/ending log message
316317
final HttpUrl url = call.request().url();
317318
final String method = call.request().method();
318-
logger.info( "Starting upstream request: [{}] {}", method, url );
319+
logger.info( "Starting upstream request: [{}] {} ({})", method, url, timestamp );
319320

320321
span.setAttribute( SemanticAttributes.HTTP_METHOD, method );
321322
span.setAttribute( SemanticAttributes.HTTP_HOST, url.host() );
@@ -335,7 +336,7 @@ public void onFailure( @NotNull Call call, @NotNull IOException e )
335336
scope.close();
336337
span.end();
337338

338-
logger.info( "Failed: [" + method + "] " + url, e );
339+
logger.warn( String.format("Failed: [%s] %s (%s)", method, url, timestamp), e );
339340
p.fail( e );
340341
}
341342

@@ -351,7 +352,7 @@ public void onResponse( @NotNull Call call, @NotNull Response response )
351352
scope.close();
352353
span.end();
353354

354-
logger.info( "Success: [" + method + "] " + url + " -> " + response.code() );
355+
logger.info( "Success: [{}] {} -> {} ({})", method, url, response.code(), timestamp );
355356
p.complete( response );
356357
}
357358
} );

0 commit comments

Comments
 (0)