Skip to content

Commit 60f74a0

Browse files
committed
[logs] changing levels
1 parent 24b2d76 commit 60f74a0

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add (class level) annotation to java bean configuration class of the MongoDB Con
3838

3939
@Configuration
4040
@EnableMongoAuditing
41-
@EnableReactiveMongoRepositories(value = { "open.source.exchange.repository.asynchronous", "<actual.application.base.package.containg.asynchronous.repositories>" })
41+
@EnableReactiveMongoRepositories(value = { "open.source.exchange.repository.asynchronous", "${application.package.containing.asynchronous.repositories}" })
4242
public class MongoReactiveConfig { }
4343

4444

src/main/java/open/source/exchange/repository/asynchronous/InformationExchangeRepoAsyncImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public <T> Mono<Boolean> updateAttribute(String identifier, String attributeName
3131
boolean wasAcknowledged = updateResult.wasAcknowledged();
3232
boolean isModifiedCountAvailable = updateResult.isModifiedCountAvailable();
3333
long modifiedCount = updateResult.getModifiedCount();
34-
log.info("update result -> (identifier) {} (attributeName) {} (matchedCount) {} (wasAcknowledged) {} (isModifiedCountAvailable) {} (modifiedCount) {}",
34+
log.debug("update result -> (identifier) {} (attributeName) {} (matchedCount) {} (wasAcknowledged) {} (isModifiedCountAvailable) {} (modifiedCount) {}",
3535
identifier, attributeName, matchedCount, wasAcknowledged, isModifiedCountAvailable, modifiedCount);
3636
return Mono.just(true);
3737
});

src/main/java/open/source/exchange/service/InformationExchangeService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public void onEntry(long startTimestamp, ServerWebExchange serverWebExchange, St
5757
.flatMap(persistedInformationExchange -> {
5858
MDC.put("requestId", requestId);
5959
MDC.put("identifier", identifier);
60-
log.info("persisted -> (informationExchange) {}", persistedInformationExchange);
60+
log.info("created entry of api call -> (requestId) {} (informationExchangeId) {}", requestId, identifier);
61+
log.debug("persisted -> (informationExchange) {}", persistedInformationExchange);
6162
parserHelper.identifyAndPersist(serverWebExchange, ExchangeInformationType.attributes);
6263
parserHelper.identifyAndPersist(serverWebExchange, ExchangeInformationType.logPrefix);
6364
parserHelper.identifyAndPersist(serverWebExchange, ExchangeInformationType.notModifiedFlag);

src/main/java/open/source/exchange/service/ParserHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void identifyAndPersist(ServerWebExchange serverWebExchange, ExchangeInfo
221221
exApplicationContext.setDocumentId(documentId);
222222
monoCall = exApplicationContextRepoAsync.insert(exApplicationContext)
223223
.flatMap(persistedExApplicationContext -> {
224-
log.info("persisted -> (exApplicationContext) {}", persistedExApplicationContext);
224+
log.debug("persisted -> (exApplicationContext) {}", persistedExApplicationContext);
225225
return Mono.just(true);
226226
});
227227
}

src/main/java/open/source/exchange/utility/asynchronous/MonoCallSynchronousExecutor.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,43 @@
99
@Log4j2
1010
public class MonoCallSynchronousExecutor {
1111

12+
private static final int THRESHOLD_SECONDS = 5;
13+
1214
private static Thread getHelperThread(Disposable disposable, String descriptor, long perodicCheckMilliSecondsTime) {
1315

1416
Object requestId = MDC.get("requestId");
1517
String id = (null != requestId) ? (String) requestId : "";
1618
Thread helperThread = new Thread() {
1719

20+
private void checkThresholdCrossed(int sleptTimes, long perodicCheckMilliSeconds) {
21+
22+
int sleptDurationInSeconds = (int) ((perodicCheckMilliSeconds * sleptTimes) / 1000);
23+
if (sleptDurationInSeconds > 0 && 0 == sleptDurationInSeconds % THRESHOLD_SECONDS ) {
24+
log.warn("{} -> (disposed) {} (eachSleepMilliSecondDuration) {} (sleptTimes) {} (sleptDurationInSeconds) {}",
25+
descriptor, false, perodicCheckMilliSeconds, sleptTimes, sleptDurationInSeconds);
26+
} else {
27+
log.debug("{} -> (disposed) {} (eachSleepMilliSecondDuration) {} (sleptTimes) {}",
28+
descriptor, false, perodicCheckMilliSeconds, sleptTimes);
29+
}
30+
}
31+
1832
@Override
1933
public void run() {
2034

2135
MDC.put("requestId", id);
2236
boolean disposed = false;
2337
int sleptTimes = 0;
2438
while (false == (disposed = disposable.isDisposed())) {
25-
log.info("{} -> (disposed) {} (sleptTimes) {}", descriptor, disposed, sleptTimes);
2639
try {
2740
this.sleep(perodicCheckMilliSecondsTime);
2841
} catch (InterruptedException e) {
2942
log.error("InterruptedException -> {}", e.getMessage(), e);
3043
break;
3144
}
3245
++sleptTimes;
46+
checkThresholdCrossed(sleptTimes, perodicCheckMilliSecondsTime);
3347
}
34-
log.info("{} -> (disposed) {}", descriptor, disposed);
48+
log.debug("{} -> (disposed) {}", descriptor, disposed);
3549
}
3650

3751
};

0 commit comments

Comments
 (0)