Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.5.2] Improve logs #4973

Merged
merged 14 commits into from
Dec 19, 2020
Merged
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
41 changes: 21 additions & 20 deletions common/src/main/java/bisq/common/app/AsciiLogo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@
@Slf4j
public class AsciiLogo {
public static void showAsciiLogo() {
log.info("\n\n" +
" ........ ...... \n" +
" .............. ...... \n" +
" ................. ...... \n" +
" ...... .......... .. ...... \n" +
" ...... ...... ...... ............... ..... ......... .......... \n" +
" ....... ........ .................. ..... ............. ............... \n" +
" ...... ........ .......... ....... ..... ...... ... ........ ....... \n" +
" ...... ..... ....... ..... ..... ..... ..... ...... \n" +
" ...... ... ... ...... ...... ..... ........... ...... ...... \n" +
" ...... ..... .... ...... ...... ..... ............ ..... ...... \n" +
" ...... ..... ...... ..... ........ ...... ...... \n" +
" ...... .... ... ...... ...... ..... .. ...... ...... ........ \n" +
" ........ .. ....... ................. ..... .............. ................... \n" +
" .......... ......... ............. ..... ............ ................. \n" +
" ...................... ..... .... .... ...... \n" +
" ................ ...... \n" +
" .... ...... \n" +
" ...... \n" +
"\n\n");
String ls = System.lineSeparator();
log.info(ls + ls +
" ........ ...... " + ls +
" .............. ...... " + ls +
" ................. ...... " + ls +
" ...... .......... .. ...... " + ls +
" ...... ...... ...... ............... ..... ......... .......... " + ls +
" ....... ........ .................. ..... ............. ............... " + ls +
" ...... ........ .......... ....... ..... ...... ... ........ ....... " + ls +
" ...... ..... ....... ..... ..... ..... ..... ...... " + ls +
" ...... ... ... ...... ...... ..... ........... ...... ...... " + ls +
" ...... ..... .... ...... ...... ..... ............ ..... ...... " + ls +
" ...... ..... ...... ..... ........ ...... ...... " + ls +
" ...... .... ... ...... ...... ..... .. ...... ...... ........ " + ls +
" ........ .. ....... ................. ..... .............. ................... " + ls +
" .......... ......... ............. ..... ............ ................. " + ls +
" ...................... ..... .... .... ...... " + ls +
" ................ ...... " + ls +
" .... ...... " + ls +
" ...... " + ls +
ls + ls);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private boolean processPeersDaoStateHash(DaoStateHash daoStateHash, Optional<Nod
if (this.isInConflictWithSeedNode)
log.warn("Conflict with seed nodes: {}", conflictMsg);
else if (this.isInConflictWithNonSeedNode)
log.info("Conflict with non-seed nodes: {}", conflictMsg);
log.debug("Conflict with non-seed nodes: {}", conflictMsg);
}


Expand Down
10 changes: 7 additions & 3 deletions core/src/main/java/bisq/core/filter/FilterManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ private void onFilterAddedFromNetwork(Filter newFilter) {
Filter currentFilter = getFilter();

if (!isFilterPublicKeyInList(newFilter)) {
log.warn("isFilterPublicKeyInList failed. Filter.getSignerPubKeyAsHex={}", newFilter.getSignerPubKeyAsHex());
if (newFilter.getSignerPubKeyAsHex() != null && !newFilter.getSignerPubKeyAsHex().isEmpty()) {
log.warn("isFilterPublicKeyInList failed. Filter.getSignerPubKeyAsHex={}", newFilter.getSignerPubKeyAsHex());
} else {
log.info("isFilterPublicKeyInList failed. Filter.getSignerPubKeyAsHex not set (expected case for pre v1.3.9 filter)");
}
return;
}
if (!isSignatureValid(newFilter)) {
Expand Down Expand Up @@ -593,7 +597,7 @@ private String getSignature(Filter filterWithoutSig) {
private boolean isFilterPublicKeyInList(Filter filter) {
String signerPubKeyAsHex = filter.getSignerPubKeyAsHex();
if (!isPublicKeyInList(signerPubKeyAsHex)) {
log.warn("Invalid filter (expected case for pre v1.3.9 filter as we still keep that in the network " +
log.info("Invalid filter (expected case for pre v1.3.9 filter as we still keep that in the network " +
"but the new version does not recognize it as valid filter): " +
"signerPubKeyAsHex from filter is not part of our pub key list. " +
"signerPubKeyAsHex={}, publicKeys={}, filterCreationDate={}",
Expand All @@ -606,7 +610,7 @@ private boolean isFilterPublicKeyInList(Filter filter) {
private boolean isPublicKeyInList(String pubKeyAsHex) {
boolean isPublicKeyInList = publicKeys.contains(pubKeyAsHex);
if (!isPublicKeyInList) {
log.warn("pubKeyAsHex is not part of our pub key list. pubKeyAsHex={}, publicKeys={}", pubKeyAsHex, publicKeys);
log.info("pubKeyAsHex is not part of our pub key list (expected case for pre v1.3.9 filter). pubKeyAsHex={}, publicKeys={}", pubKeyAsHex, publicKeys);
}
return isPublicKeyInList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public void onAllServicesInitialized() {
}

private void onOpenOfferRemoved(OpenOffer openOffer) {
log.info("We got a offer removed. id={}, state={}", openOffer.getId(), openOffer.getState());
if (openOffer.getState() == OpenOffer.State.RESERVED) {
OpenOffer.State state = openOffer.getState();
if (state == OpenOffer.State.RESERVED) {
log.info("We got a offer removed. id={}, state={}", openOffer.getId(), state);
String shortId = openOffer.getShortId();
MobileMessage message = new MobileMessage(Res.get("account.notifications.offer.message.title"),
Res.get("account.notifications.offer.message.msg", shortId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ public void applyBannedNodes(@Nullable List<String> bannedNodes) {
fillProviderList();
selectNextProviderBaseUrl();

if (bannedNodes == null) {
log.info("Selected provider baseUrl={}, providerList={}", baseUrl, providerList);
} else if (!bannedNodes.isEmpty()) {
log.warn("We have banned provider nodes: bannedNodes={}, selected provider baseUrl={}, providerList={}",
if (bannedNodes != null && !bannedNodes.isEmpty()) {
log.info("Excluded provider nodes from filter: nodes={}, selected provider baseUrl={}, providerList={}",
bannedNodes, baseUrl, providerList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ static void setSupportedCapabilities(Config config) {
if (config.daoActivated) {
maybeApplyDaoFullMode(config);
}

log.info(Capabilities.app.prettyPrint());
}

public static void maybeApplyDaoFullMode(Config config) {
// If we set dao full mode at the preferences view we add the capability there. We read the preferences a
// bit later than we call that method so we have to add DAO_FULL_NODE Capability at preferences as well to
// be sure it is set in both cases.
if (config.fullDaoNode) {
log.info("Set Capability.DAO_FULL_NODE");
Capabilities.app.addAll(Capability.DAO_FULL_NODE);
} else {
// A lite node has the capability to receive bsq blocks. We do not want to send BSQ blocks to full nodes
// as they ignore them anyway.
log.info("Set Capability.RECEIVE_BSQ_BLOCK");
Capabilities.app.addAll(Capability.RECEIVE_BSQ_BLOCK);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ private boolean isPubKeyValid(DecryptedMessageWithPubKey message, Trade trade) {
if (peersPubKeyRing != null &&
!message.getSignaturePubKey().equals(peersPubKeyRing.getSignaturePubKey())) {
isValid = false;
log.error("SignaturePubKey in message does not match the SignaturePubKey we have set for our trading peer.");
// We iterate over all trades so it is expected that the msg which are not assigned to that trade fails.
log.debug("SignaturePubKey in message does not match the SignaturePubKey we have set for our trading peer.");
}
return isValid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ private Result getPhaseResult() {
log.info(info);
return Result.VALID.info(info);
} else {
String info = MessageFormat.format("We received a {0} but we are are not in the expected phase. " +
"Expected phases={1}, Trade phase={2}, Trade state= {3}, tradeId={4}",
String info = MessageFormat.format("We received a {0} but we are are not in the expected phase.\n" +
"This can be an expected case if we get a repeated CounterCurrencyTransferStartedMessage " +
"after we have already received one as the peer re-sends that message at each startup.\n" +
"Expected phases={1},\nTrade phase={2},\nTrade state= {3},\ntradeId={4}",
trigger,
expectedPhases,
trade.getPhase(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected FluentProtocol expect(FluentProtocol.Condition condition) {
.condition(condition)
.resultHandler(result -> {
if (!result.isValid()) {
log.error(result.getInfo());
log.warn(result.getInfo());
handleTaskRunnerFault(null,
result.name(),
result.getInfo());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,8 @@ public void onAllServicesInitialized() {
onP2pNetworkAndWalletReady();
} else {
p2pNetworkAndWalletReady = EasyBind.combine(isP2pBootstrapped, hasSufficientBtcPeers, isBtcBlockDownloadComplete,
(bootstrapped, sufficientPeers, downloadComplete) -> {
log.info("isP2pBootstrapped={}, hasSufficientBtcPeers={} isBtcBlockDownloadComplete={}",
bootstrapped, sufficientPeers, downloadComplete);
return bootstrapped && sufficientPeers && downloadComplete;
});
(bootstrapped, sufficientPeers, downloadComplete) ->
bootstrapped && sufficientPeers && downloadComplete);

p2pNetworkAndWalletReadyListener = (observable, oldValue, newValue) -> {
if (newValue) {
Expand Down
8 changes: 4 additions & 4 deletions p2p/src/main/java/bisq/network/http/HttpClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private String requestWithoutProxy(String baseUrl,
@Nullable String headerKey,
@Nullable String headerValue) throws IOException {
long ts = System.currentTimeMillis();
log.info("requestWithoutProxy: URL={}, param={}, httpMethod={}", baseUrl, param, httpMethod);
log.debug("requestWithoutProxy: URL={}, param={}, httpMethod={}", baseUrl, param, httpMethod);
try {
String spec = httpMethod == HttpMethod.GET ? baseUrl + param : baseUrl;
URL url = new URL(spec);
Expand All @@ -171,7 +171,7 @@ private String requestWithoutProxy(String baseUrl,
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
String response = convertInputStreamToString(connection.getInputStream());
log.info("Response from {} with param {} took {} ms. Data size:{}, response: {}",
log.debug("Response from {} with param {} took {} ms. Data size:{}, response: {}",
baseUrl,
param,
System.currentTimeMillis() - ts,
Expand Down Expand Up @@ -223,7 +223,7 @@ private String doRequestWithProxy(String baseUrl,
@Nullable String headerKey,
@Nullable String headerValue) throws IOException {
long ts = System.currentTimeMillis();
log.info("requestWithoutProxy: baseUrl={}, param={}, httpMethod={}", baseUrl, param, httpMethod);
log.debug("doRequestWithProxy: baseUrl={}, param={}, httpMethod={}", baseUrl, param, httpMethod);
// This code is adapted from:
// http://stackoverflow.com/a/25203021/5616248

Expand Down Expand Up @@ -257,7 +257,7 @@ private String doRequestWithProxy(String baseUrl,
String response = convertInputStreamToString(httpResponse.getEntity().getContent());
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode == 200) {
log.info("Response from {} took {} ms. Data size:{}, response: {}, param: {}",
log.debug("Response from {} took {} ms. Data size:{}, response: {}, param: {}",
baseUrl,
System.currentTimeMillis() - ts,
Utilities.readableFileSize(response.getBytes().length),
Expand Down
3 changes: 2 additions & 1 deletion p2p/src/main/java/bisq/network/p2p/network/Statistic.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -85,7 +86,7 @@ public class Statistic {
totalReceivedBytes.get() / 1024d,
numTotalReceivedMessages.get(), totalReceivedMessages,
numTotalReceivedMessagesPerSec.get());
}, 60);
}, TimeUnit.MINUTES.toSeconds(5));
}

public static LongProperty totalSentBytesProperty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ public void run() {
}
return null;
});
log.info("It will take some time for the HS to be reachable (~40 seconds). You will be notified about this");
} catch (TorCtlException e) {
String msg = e.getCause() != null ? e.getCause().toString() : e.toString();
log.error("Tor node creation failed: {}", msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ private void removeFromMapAndDataStore(Collection<Map.Entry<ByteArray,
if (entriesToRemoveWithPayloadHash.isEmpty())
return;

log.info("Remove {} expired data entries", entriesToRemoveWithPayloadHash.size());
log.debug("Remove {} expired data entries", entriesToRemoveWithPayloadHash.size());

ArrayList<ProtectedStorageEntry> entriesForSignal = new ArrayList<>(entriesToRemoveWithPayloadHash.size());
entriesToRemoveWithPayloadHash.forEach(entryToRemoveWithPayloadHash -> {
Expand Down