Merge pull request #4973 from chimp1984/improve-logs

[1.5.2] Improve logs
This commit is contained in:
sqrrm 2020-12-19 23:36:21 +01:00 committed by GitHub
commit 442d65a730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 52 additions and 48 deletions

View File

@ -22,25 +22,26 @@ import lombok.extern.slf4j.Slf4j;
@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);
}
}

View File

@ -371,7 +371,7 @@ public class DaoStateMonitoringService implements DaoSetupService, DaoStateListe
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);
}

View File

@ -466,7 +466,11 @@ public class FilterManager {
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)) {
@ -593,7 +597,7 @@ public class FilterManager {
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={}",
@ -606,7 +610,7 @@ public class FilterManager {
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;
}

View File

@ -55,8 +55,9 @@ public class MyOfferTakenEvents {
}
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),

View File

@ -79,10 +79,8 @@ public class ProvidersRepository {
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);
}
}

View File

@ -47,6 +47,8 @@ public class CoreNetworkCapabilities {
if (config.daoActivated) {
maybeApplyDaoFullMode(config);
}
log.info(Capabilities.app.prettyPrint());
}
public static void maybeApplyDaoFullMode(Config config) {
@ -54,12 +56,10 @@ public class CoreNetworkCapabilities {
// 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);
}
}

View File

@ -124,7 +124,8 @@ public class CleanupMailboxMessages {
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;
}

View File

@ -286,8 +286,10 @@ public class FluentProtocol {
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(),

View File

@ -196,7 +196,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
.condition(condition)
.resultHandler(result -> {
if (!result.isValid()) {
log.error(result.getInfo());
log.warn(result.getInfo());
handleTaskRunnerFault(null,
result.name(),
result.getInfo());

View File

@ -132,11 +132,8 @@ public class XmrTxProofService implements AssetTxProofService {
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) {

View File

@ -150,7 +150,7 @@ public class HttpClientImpl implements HttpClient {
@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);
@ -171,7 +171,7 @@ public class HttpClientImpl implements HttpClient {
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,
@ -223,7 +223,7 @@ public class HttpClientImpl implements HttpClient {
@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
@ -257,7 +257,7 @@ public class HttpClientImpl implements HttpClient {
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),

View File

@ -30,6 +30,7 @@ import javafx.beans.property.SimpleLongProperty;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
@ -85,7 +86,7 @@ public class Statistic {
totalReceivedBytes.get() / 1024d,
numTotalReceivedMessages.get(), totalReceivedMessages,
numTotalReceivedMessagesPerSec.get());
}, 60);
}, TimeUnit.MINUTES.toSeconds(5));
}
public static LongProperty totalSentBytesProperty() {

View File

@ -280,7 +280,6 @@ public class TorNetworkNode extends NetworkNode {
}
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);

View File

@ -944,7 +944,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
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 -> {