Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private Set<OtherKnowledgeBase> filterOtherKnowledgeBases(Set<OtherKnowledgeBase

String queryString = createQuery(aSelector.getPattern(),
Util.translateFromApiBindingSet(aSelector.getBindingSet()));
LOG.debug("Query: {}", queryString);
LOG.trace("Query: {}", queryString);
Query q = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(q, m);
ResultSet rs = qe.execSelect();
Expand Down Expand Up @@ -227,7 +227,7 @@ public CompletableFuture<AnswerMessage> processAskFromMessageRouter(AskMessage a
AnswerMessage m = new AnswerMessage(anAskMsg.getToKnowledgeBase(), anAskMsg.getToKnowledgeInteraction(),
anAskMsg.getFromKnowledgeBase(), anAskMsg.getFromKnowledgeInteraction(), anAskMsg.getMessageId(),
"Received AskMessage wth unknown ToKnowledgeInteractionId");
LOG.debug("Received AskMessage with unknown ToKnowledgeInteractionId: "
LOG.trace("Received AskMessage with unknown ToKnowledgeInteractionId: "
+ anAskMsg.getToKnowledgeInteraction().toString());
CompletableFuture<AnswerMessage> f = new CompletableFuture<>();
f.complete(m);
Expand All @@ -243,7 +243,7 @@ public CompletableFuture<AnswerMessage> processAskFromMessageRouter(AskMessage a
// TODO This should happen in the single thread for the knowledge base

if (answerKnowledgeInteraction.isMeta()) {
LOG.debug("Contacting my KB to answer KI <{}>", answerKnowledgeInteractionId);
LOG.trace("Contacting my KB to answer KI <{}>", answerKnowledgeInteractionId);
} else {
LOG.info("Contacting my KB to answer KI <{}>", answerKnowledgeInteractionId);
}
Expand All @@ -255,7 +255,13 @@ public CompletableFuture<AnswerMessage> processAskFromMessageRouter(AskMessage a

return future.handle((b, e) -> {
if (b != null && e == null) {
LOG.debug("Received ANSWER from KB for KI <{}>: {}", answerKnowledgeInteractionId, b);

String logStatement = "Received {} binding(s) as answer from my KB for KI <{}>";
if (!answerKnowledgeInteraction.isMeta())
LOG.debug(logStatement, b.size(), answerKnowledgeInteractionId);
else
LOG.trace(logStatement, b.size(), answerKnowledgeInteractionId);

BindingSet translatedB = Util.translateFromApiBindingSet(b);

if (this.shouldValidateInputOutputBindings()) {
Expand All @@ -280,7 +286,7 @@ public CompletableFuture<AnswerMessage> processAskFromMessageRouter(AskMessage a
}
}).exceptionally((e) -> {
LOG.error("An error occurred while answering a msg: ", e);
LOG.debug("The error occured while answering this message: {}", anAskMsg);
LOG.trace("The error occured while answering this message: {}", anAskMsg);
return new AnswerMessage(anAskMsg.getToKnowledgeBase(), answerKnowledgeInteractionId,
anAskMsg.getFromKnowledgeBase(), anAskMsg.getFromKnowledgeInteraction(), anAskMsg.getMessageId(),
e.getMessage());
Expand Down Expand Up @@ -340,7 +346,7 @@ public CompletableFuture<ReactMessage> processPostFromMessageRouter(PostMessage
ReactMessage m = new ReactMessage(aPostMsg.getToKnowledgeBase(), aPostMsg.getToKnowledgeInteraction(),
aPostMsg.getFromKnowledgeBase(), aPostMsg.getFromKnowledgeInteraction(), aPostMsg.getMessageId(),
"Received PostMessage with unknown ToKnowledgeInteractionId");
LOG.debug("Received PostMessage with unknown ToKnowledgeInteractionId: "
LOG.trace("Received PostMessage with unknown ToKnowledgeInteractionId: "
+ aPostMsg.getToKnowledgeInteraction().toString());
CompletableFuture<ReactMessage> f = new CompletableFuture<>();
f.complete(m);
Expand All @@ -358,7 +364,7 @@ public CompletableFuture<ReactMessage> processPostFromMessageRouter(PostMessage

// TODO This should happen in the single thread for the knowledge base
if (reactKnowledgeInteraction.isMeta()) {
LOG.debug("Contacting my KB to react to KI <{}>", reactKnowledgeInteractionId);
LOG.trace("Contacting my KB to react to KI <{}>", reactKnowledgeInteractionId);
} else {
LOG.info("Contacting my KB to react to KI <{}>", reactKnowledgeInteractionId);
}
Expand All @@ -367,7 +373,12 @@ public CompletableFuture<ReactMessage> processPostFromMessageRouter(PostMessage

return future.handle((b, e) -> {
if (b != null && e == null) {
LOG.debug("Received REACT from KB for KI <{}>: {}", reactKnowledgeInteraction, b);
String logStatement = "Received {} binding(s) as react from my KB for KI <{}>";
if (!reactKnowledgeInteraction.isMeta())
LOG.debug(logStatement, b.size(), reactKnowledgeInteractionId);
else
LOG.trace(logStatement, b.size(), reactKnowledgeInteractionId);

BindingSet translatedB = Util.translateFromApiBindingSet(b);

if (this.shouldValidateInputOutputBindings()) {
Expand All @@ -393,7 +404,7 @@ public CompletableFuture<ReactMessage> processPostFromMessageRouter(PostMessage
}
}).exceptionally((e) -> {
LOG.error("An error occurred while reacting to a message:", e);
LOG.debug("The error occured while reacting to this message: {}", aPostMsg);
LOG.trace("The error occured while reacting to this message: {}", aPostMsg);
return new ReactMessage(aPostMsg.getToKnowledgeBase(), reactKnowledgeInteractionId,
aPostMsg.getFromKnowledgeBase(), aPostMsg.getFromKnowledgeInteraction(), aPostMsg.getMessageId(),
e.getMessage());
Expand Down Expand Up @@ -539,7 +550,7 @@ public int getReasonerLevel() {
private void readAdditionalDomainKnowledge(String pathString) {
Path p = FileSystems.getDefault().getPath(pathString);

LOG.debug("Reading additional domain knowledge from path: " + p.toAbsolutePath());
LOG.trace("Reading additional domain knowledge from path: " + p.toAbsolutePath());

try (BufferedReader r = Files.newBufferedReader(p.toAbsolutePath(), StandardCharsets.UTF_8)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public CompletableFuture<AnswerMessage> sendAskMessage(AskMessage askMessage) th
LOG.error("KB '{}' did not respond within {}s to AskMessage '{}'.",
askMessage.getToKnowledgeBase(), this.getWaitTimeout(), askMessage.getMessageId());
else if (e instanceof CancellationException)
LOG.debug("Waiting for AnswerMessage to AskMessage '{}' was cancelled due to a stopping SC.",
LOG.trace("Waiting for AnswerMessage to AskMessage '{}' was cancelled due to a stopping SC.",
askMessage.getMessageId());
else
LOG.error("A {} occurred while sending an AskMessage.", e.getClass().getSimpleName(), e);
Expand Down Expand Up @@ -130,7 +130,7 @@ else if (e instanceof CancellationException)
throw ioe;
}

LOG.debug("Sent AskMessage: {}", askMessage);
LOG.trace("Sent AskMessage: {}", askMessage);

return future;
}
Expand All @@ -151,7 +151,7 @@ public CompletableFuture<ReactMessage> sendPostMessage(PostMessage postMessage)
LOG.warn("KB '{}' did not respond within {}s to PostMessage '{}'.",
postMessage.getToKnowledgeBase(), this.getWaitTimeout(), postMessage.getMessageId());
else if (e instanceof CancellationException)
LOG.debug("Waiting for ReactMessage to PostMessage '{}' was cancelled due to a stopping SC.",
LOG.trace("Waiting for ReactMessage to PostMessage '{}' was cancelled due to a stopping SC.",
postMessage.getMessageId());
else
LOG.error("A {} occurred while sending an PostMessage.", e.getClass().getSimpleName(), e);
Expand All @@ -177,7 +177,7 @@ else if (e instanceof CancellationException)
// and re throw
throw ioe;
}
LOG.debug("Sent PostMessage: {}", postMessage);
LOG.trace("Sent PostMessage: {}", postMessage);

return future;
}
Expand All @@ -201,7 +201,7 @@ public void handleAskMessage(AskMessage message) {
messageDispatcher.send(reply);
} catch (Throwable e) {
this.LOG.warn("Could not send reply to message " + message.getMessageId() + ": " + e.getMessage());
this.LOG.debug("", e);
this.LOG.trace("", e);
}
}).handle((r, e) -> {

Expand Down Expand Up @@ -258,7 +258,7 @@ public void handleAnswerMessage(AnswerMessage answerMessage) {
+ ", but I don't remember sending a message with that ID. It might have taken more than {}s to respond.",
this.getWaitTimeout());
} else {
LOG.debug("Received AnswerMessage: {}", answerMessage);
LOG.trace("Received AnswerMessage: {}", answerMessage);
future.complete(answerMessage);
}
}
Expand All @@ -277,7 +277,7 @@ public void handleReactMessage(ReactMessage reactMessage) {
} else {
assert reactMessage != null;
assert future != null;
LOG.debug("Received ReactMessage: {}", reactMessage);
LOG.trace("Received ReactMessage: {}", reactMessage);
future.complete(reactMessage);
}
}
Expand Down Expand Up @@ -341,7 +341,7 @@ public void stop() {
if (future.cancel(true))
i++;
}
LOG.debug("MessageRouterImpl stopped. Cancelled {} message(s).", i);
LOG.trace("MessageRouterImpl stopped. Cancelled {} message(s).", i);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public CompletableFuture<Void> populate() {
@Override
public void addKnowledgeBase(OtherKnowledgeBase kb) {
if (this.otherKnowledgeBases.containsKey(kb.getId())) {
LOG.warn("Tried to add a knowledge base {}, but it is already in my store! Skipped it.", kb.getId());
LOG.trace("Tried to add a knowledge base {}, but it is already in my store! Skipped it.", kb.getId());
return;
}

Expand All @@ -106,7 +106,7 @@ public void addKnowledgeBase(OtherKnowledgeBase kb) {
@Override
public void updateKnowledgeBase(OtherKnowledgeBase kb) {
if (!this.otherKnowledgeBases.containsKey(kb.getId())) {
LOG.warn("Tried to update knowledge base {}, but it is not in my store! Skipped it.", kb.getId());
LOG.trace("Tried to update knowledge base {}, but it is not in my store! Skipped it.", kb.getId());
return;
}

Expand All @@ -120,7 +120,7 @@ public void updateKnowledgeBase(OtherKnowledgeBase kb) {
@Override
public void removeKnowledgeBase(OtherKnowledgeBase kb) {
if (!this.otherKnowledgeBases.containsKey(kb.getId())) {
LOG.warn("Tried to remove knowledge base {}, but it isn't even in my store! Skipped it.", kb.getId());
LOG.trace("Tried to remove knowledge base {}, but it isn't even in my store! Skipped it.", kb.getId());
return;
}

Expand Down
Loading
Loading