Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
df1eace
[WIP] Find everywhere Json is written to the log
ximinez Oct 10, 2025
cc72e7d
Merge branch 'develop' into logging
ximinez Nov 12, 2025
0aa1d18
Merge branch 'develop' into logging
ximinez Nov 13, 2025
ea26772
Merge branch 'develop' into logging
ximinez Nov 15, 2025
3bfc93d
Merge branch 'develop' into logging
ximinez Nov 19, 2025
581db3a
Merge branch 'develop' into logging
ximinez Nov 21, 2025
4015200
Merge branch 'develop' into logging
ximinez Nov 25, 2025
37a02e4
Merge branch 'develop' into logging
ximinez Nov 28, 2025
028b2b3
Merge branch 'develop' into logging
ximinez Dec 1, 2025
cab9f43
Merge branch 'develop' into logging
ximinez Dec 3, 2025
52de997
Merge branch 'develop' into logging
ximinez Dec 6, 2025
896cfea
Merge remote-tracking branch 'ximinez/develop' into logging
ximinez Dec 13, 2025
0f09cf9
Merge branch 'develop' into logging
ximinez Dec 19, 2025
f97303d
Merge branch 'develop' into logging
ximinez Dec 22, 2025
1765257
Merge branch 'develop' into logging
ximinez Jan 6, 2026
415d8d4
Merge branch 'develop' into logging
ximinez Jan 8, 2026
b32eaba
Merge branch 'develop' into logging
ximinez Jan 8, 2026
857269b
Merge branch 'develop' into logging
ximinez Jan 11, 2026
3c516e2
Merge branch 'develop' into logging
ximinez Jan 12, 2026
daac061
Merge branch 'develop' into logging
ximinez Jan 13, 2026
f899e21
Merge remote-tracking branch 'ximinez/develop' into logging
ximinez Jan 15, 2026
43133c8
Merge commit '92046785d1fea5f9efe5a770d636792ea6cab78b' into logging
ximinez Jan 28, 2026
c264fb7
Merge commit '5f638f55536def0d88b970d1018a465a238e55f4' into logging
ximinez Jan 28, 2026
4a4dcef
Merge branch 'develop' into logging
ximinez Jan 28, 2026
4180200
Fix formatting
ximinez Jan 29, 2026
c574e28
Merge branch 'develop' into logging
ximinez Feb 4, 2026
b8480bf
Merge remote-tracking branch 'ximinez/develop' into logging
ximinez Feb 19, 2026
ae85e45
Merge branch 'develop' into logging
ximinez Feb 19, 2026
01526d5
Merge commit '25cca465538a56cce501477f9e5e2c1c7ea2d84c' into logging
ximinez Feb 21, 2026
38e73d4
Update formatting
ximinez Feb 21, 2026
c700754
Merge commit '2c1fad1023' into logging
ximinez Feb 21, 2026
73789a6
Merge remote-tracking branch 'ximinez/develop' into logging
ximinez Feb 21, 2026
ffb2649
Merge branch 'develop' into logging
ximinez Feb 24, 2026
5f2c98a
Merge branch 'develop' into logging
ximinez Mar 4, 2026
77b6801
Merge branch 'develop' into logging
ximinez Mar 4, 2026
13a0a0b
Merge branch 'develop' into logging
ximinez Mar 6, 2026
80ae8be
Merge branch 'develop' into logging
ximinez Mar 10, 2026
5d61867
Merge remote-tracking branch 'ximinez/develop' into logging
ximinez Apr 14, 2026
c97d895
Merge branch 'develop' into logging
ximinez Apr 15, 2026
5ed019e
Merge branch 'develop' into logging
ximinez Apr 15, 2026
85188ad
Merge branch 'develop' into logging
ximinez Apr 16, 2026
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
4 changes: 2 additions & 2 deletions include/xrpl/json/json_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ valueToQuotedString(char const* value);

/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
std::ostream&
operator<<(std::ostream&, Value const& root);
// std::ostream&
// operator<<(std::ostream&, Value const& root);

//------------------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/json/to_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ to_string(Value const&);
std::string
pretty(Value const&);

/** Output using the StyledStreamWriter. @see Json::operator>>(). */
std::ostream&
operator<<(std::ostream&, Value const& root);
// /** Output using the StyledStreamWriter. @see Json::operator>>(). */
// std::ostream&
// operator<<(std::ostream&, Value const& root);

} // namespace Json
3 changes: 2 additions & 1 deletion include/xrpl/protocol/STValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/json/to_string.h>
#include <xrpl/protocol/PublicKey.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/SecretKey.h>
Expand Down Expand Up @@ -161,7 +162,7 @@ STValidation::STValidation(SerialIter& sit, LookupNodeID&& lookupNodeID, bool ch
if (checkSignature && !isValid())
{
JLOG(debugLog().error()) << "Invalid signature in validation: "
<< getJson(JsonOptions::none);
<< to_string(getJson(JsonOptions::none));
Throw<std::runtime_error>("Invalid signature in validation");
}

Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/ledger/ApplyStateTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ApplyStateTable::apply(

// VFALCO For diagnostics do we want to show
// metadata even when the base view is open?
JLOG(j.trace()) << "metadata " << meta.getJson(JsonOptions::none);
JLOG(j.trace()) << "metadata " << to_string(meta.getJson(JsonOptions::none));

metadata = meta;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/tx/Transactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,8 @@ Transactor::operator()()
{
// LCOV_EXCL_START
JLOG(j_.fatal()) << "Transaction serdes mismatch";
JLOG(j_.fatal()) << ctx_.tx.getJson(JsonOptions::none);
JLOG(j_.fatal()) << s2.getJson(JsonOptions::none);
JLOG(j_.fatal()) << to_string(ctx_.tx.getJson(JsonOptions::none));
JLOG(j_.fatal()) << to_string(s2.getJson(JsonOptions::none));
UNREACHABLE("xrpl::Transactor::operator() : transaction serdes mismatch");
// LCOV_EXCL_STOP
}
Expand Down
4 changes: 3 additions & 1 deletion src/libxrpl/tx/paths/PaySteps.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <xrpl/basics/contract.h>
#include <xrpl/json/json_writer.h>
#include <xrpl/json/to_string.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/IOUAmount.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/tx/paths/detail/Steps.h>
Expand Down Expand Up @@ -642,7 +644,7 @@ toStrands(
{
lastFailTer = ter;
JLOG(j.trace()) << "failed to add path: ter: " << ter
<< "path: " << p.getJson(JsonOptions::none);
<< "path: " << to_string(p.getJson(JsonOptions::none));
if (isTemMalformed(ter))
return {ter, std::vector<Strand>{}};
}
Expand Down
1 change: 1 addition & 0 deletions src/test/app/Oracle_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <test/jtx/Oracle.h>

#include <xrpl/json/to_string.h>
#include <xrpl/protocol/jss.h>

namespace xrpl {
Expand Down
1 change: 1 addition & 0 deletions src/test/jtx/TestSuite.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <xrpl/beast/unit_test.h>
#include <xrpl/json/to_string.h>

#include <string>

Expand Down
4 changes: 2 additions & 2 deletions src/test/protocol/STObject_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class STObject_test : public beast::unit_test::suite

if (object1.getSerializer() == object2.getSerializer())
{
log << "O1: " << object1.getJson(JsonOptions::none) << '\n'
<< "O2: " << object2.getJson(JsonOptions::none) << std::endl;
log << "O1: " << to_string(object1.getJson(JsonOptions::none)) << '\n'
<< "O2: " << to_string(object2.getJson(JsonOptions::none)) << std::endl;
fail("STObject error 4");
}
else
Expand Down
8 changes: 4 additions & 4 deletions src/test/protocol/STTx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,8 @@ class STTx_test : public beast::unit_test::suite

if (copy != j)
{
log << "j=" << j.getJson(JsonOptions::none) << '\n'
<< "copy=" << copy.getJson(JsonOptions::none) << std::endl;
log << "j=" << to_string(j.getJson(JsonOptions::none)) << '\n'
<< "copy=" << to_string(copy.getJson(JsonOptions::none)) << std::endl;
fail("Transaction fails serialize/deserialize test");
}
else
Expand All @@ -1349,8 +1349,8 @@ class STTx_test : public beast::unit_test::suite
}
else if (STObject(j) != parsed.object)
{
log << "ORIG: " << j.getJson(JsonOptions::none) << '\n'
<< "BUILT " << parsed.object->getJson(JsonOptions::none) << std::endl;
log << "ORIG: " << to_string(j.getJson(JsonOptions::none)) << '\n'
<< "BUILT " << to_string(parsed.object->getJson(JsonOptions::none)) << std::endl;
fail("Built a different transaction");
}
else
Expand Down
18 changes: 9 additions & 9 deletions src/test/rpc/KeyGeneration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class WalletPropose_test : public xrpl::TestSuite
BEAST_EXPECT(result.isMember(jss::key_type));

expectEquals(
result[jss::key_type],
params.isMember(jss::key_type) ? params[jss::key_type] : "secp256k1");
to_string(result[jss::key_type]),
params.isMember(jss::key_type) ? to_string(params[jss::key_type]) : "secp256k1");
BEAST_EXPECT(!result.isMember(jss::warning));

std::string const seed = result[jss::master_seed].asString();
Expand All @@ -112,14 +112,14 @@ class WalletPropose_test : public xrpl::TestSuite
Json::Value result = walletPropose(params);

BEAST_EXPECT(!contains_error(result));
expectEquals(result[jss::account_id], s.account_id);
expectEquals(result[jss::master_seed], s.master_seed);
expectEquals(result[jss::master_seed_hex], s.master_seed_hex);
expectEquals(result[jss::public_key], s.public_key);
expectEquals(result[jss::public_key_hex], s.public_key_hex);
expectEquals(to_string(result[jss::account_id]), s.account_id);
expectEquals(to_string(result[jss::master_seed]), s.master_seed);
expectEquals(to_string(result[jss::master_seed_hex]), s.master_seed_hex);
expectEquals(to_string(result[jss::public_key]), s.public_key);
expectEquals(to_string(result[jss::public_key_hex]), s.public_key_hex);
expectEquals(
result[jss::key_type],
params.isMember(jss::key_type) ? params[jss::key_type] : "secp256k1");
to_string(result[jss::key_type]),
params.isMember(jss::key_type) ? to_string(params[jss::key_type]) : "secp256k1");
return result;
}

Expand Down
37 changes: 37 additions & 0 deletions src/test/rpc/LedgerData_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,43 @@ class LedgerData_test : public beast::unit_test::suite
BEAST_EXPECT(j["LedgerEntryType"] == jss::DepositPreauth);
}

{ // jvParams[jss::type] = "misspelling";
Json::Value jvParams;
jvParams[jss::ledger_index] = "current";
jvParams[jss::type] = "misspelling";
auto const jrr = env.rpc("json", "ledger_data", to_string(jvParams))[jss::result];
BEAST_EXPECT(jrr.isMember("error"));
BEAST_EXPECT(jrr["error"] == "invalidParams");
BEAST_EXPECT(jrr["error_message"] == "Invalid field 'type'.");
}
{ // jvParams[jss::type] = "ticket";
auto const jrr = makeRequest(jss::ticket);
BEAST_EXPECT(checkArraySize(jrr[jss::state], 1));
for (auto const& j : jrr[jss::state])
BEAST_EXPECT(j["LedgerEntryType"] == jss::Ticket);
}

{ // jvParams[jss::type] = "escrow";
auto const jrr = makeRequest(jss::escrow);
BEAST_EXPECT(checkArraySize(jrr[jss::state], 1));
for (auto const& j : jrr[jss::state])
BEAST_EXPECT(j["LedgerEntryType"] == jss::Escrow);
}

{ // jvParams[jss::type] = "payment_channel";
auto const jrr = makeRequest(jss::payment_channel);
BEAST_EXPECT(checkArraySize(jrr[jss::state], 1));
for (auto const& j : jrr[jss::state])
BEAST_EXPECT(j["LedgerEntryType"] == jss::PayChannel);
}

{ // jvParams[jss::type] = "deposit_preauth";
auto const jrr = makeRequest(jss::deposit_preauth);
BEAST_EXPECT(checkArraySize(jrr[jss::state], 2));
for (auto const& j : jrr[jss::state])
BEAST_EXPECT(j["LedgerEntryType"] == jss::DepositPreauth);
}

{ // jvParams[jss::type] = "misspelling";
Json::Value jvParams;
jvParams[jss::ledger_index] = "current";
Expand Down
4 changes: 3 additions & 1 deletion src/tests/libxrpl/json/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <xrpl/json/json_reader.h>
#include <xrpl/json/json_value.h>
#include <xrpl/json/json_writer.h>
#include <xrpl/json/to_string.h>

#include <gtest/gtest.h>

Expand Down Expand Up @@ -841,7 +842,8 @@ TEST(json_value, compact)
EXPECT_TRUE(r.parse(s, j));
{
std::stringstream ss;
ss << j;
// UNDO
ss << pretty(j);
EXPECT_GT(countLines(ss.str()), 1);
}
{
Expand Down
34 changes: 18 additions & 16 deletions src/xrpld/app/ledger/LedgerHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ log_one(ReadView const& ledger, uint256 const& tx, char const* msg, beast::Journ
{
JLOG(j.debug()) << "MISMATCH on TX " << tx << ": " << msg
<< " is missing this transaction:\n"
<< metaData->getJson(JsonOptions::none);
<< to_string(metaData->getJson(JsonOptions::none));
}
else
{
Expand Down Expand Up @@ -223,38 +223,40 @@ log_metadata_difference(
{
JLOG(j.debug()) << "MISMATCH on TX " << tx
<< ": Different result, index and nodes!";
JLOG(j.debug()) << " Built:\n" << builtMetaData->getJson(JsonOptions::none);
JLOG(j.debug()) << " Valid:\n" << validMetaData->getJson(JsonOptions::none);
JLOG(j.debug()) << " Built:\n"
<< to_string(builtMetaData->getJson(JsonOptions::none));
JLOG(j.debug()) << " Valid:\n"
<< to_string(validMetaData->getJson(JsonOptions::none));
}
else if (result_diff)
{
JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result and nodes!";
JLOG(j.debug()) << " Built:"
<< " Result: " << builtMetaData->getResult() << " Nodes:\n"
<< builtNodes.getJson(JsonOptions::none);
<< to_string(builtNodes.getJson(JsonOptions::none));
JLOG(j.debug()) << " Valid:"
<< " Result: " << validMetaData->getResult() << " Nodes:\n"
<< validNodes.getJson(JsonOptions::none);
<< to_string(validNodes.getJson(JsonOptions::none));
}
else if (index_diff)
{
JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different index and nodes!";
JLOG(j.debug()) << " Built:"
<< " Index: " << builtMetaData->getIndex() << " Nodes:\n"
<< builtNodes.getJson(JsonOptions::none);
<< to_string(builtNodes.getJson(JsonOptions::none));
JLOG(j.debug()) << " Valid:"
<< " Index: " << validMetaData->getIndex() << " Nodes:\n"
<< validNodes.getJson(JsonOptions::none);
<< to_string(validNodes.getJson(JsonOptions::none));
}
else // nodes_diff
{
JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different nodes!";
JLOG(j.debug()) << " Built:"
<< " Nodes:\n"
<< builtNodes.getJson(JsonOptions::none);
<< to_string(builtNodes.getJson(JsonOptions::none));
JLOG(j.debug()) << " Valid:"
<< " Nodes:\n"
<< validNodes.getJson(JsonOptions::none);
<< to_string(validNodes.getJson(JsonOptions::none));
}
}

Expand All @@ -264,13 +266,13 @@ log_metadata_difference(
if (validMetaData)
{
JLOG(j.error()) << "MISMATCH on TX " << tx << ": Metadata Difference. Valid=\n"
<< validMetaData->getJson(JsonOptions::none);
<< to_string(validMetaData->getJson(JsonOptions::none));
}

if (builtMetaData)
{
JLOG(j.error()) << "MISMATCH on TX " << tx << ": Metadata Difference. Built=\n"
<< builtMetaData->getJson(JsonOptions::none);
<< to_string(builtMetaData->getJson(JsonOptions::none));
}
}

Expand Down Expand Up @@ -317,9 +319,9 @@ LedgerHistory::handleMismatch(

if (auto stream = j_.debug())
{
stream << "Built: " << getJson({*builtLedger, {}});
stream << "Valid: " << getJson({*validLedger, {}});
stream << "Consensus: " << consensus;
stream << "Built: " << to_string(getJson({*builtLedger, {}}));
stream << "Valid: " << to_string(getJson({*validLedger, {}}));
stream << "Consensus: " << to_string(consensus);
}

// Determine the mismatch reason, distinguishing Byzantine
Expand Down Expand Up @@ -364,8 +366,8 @@ LedgerHistory::handleMismatch(
JLOG(j_.error()) << "MISMATCH with " << builtTx.size() << " built and " << validTx.size()
<< " valid transactions.";

JLOG(j_.error()) << "built\n" << getJson({*builtLedger, {}});
JLOG(j_.error()) << "valid\n" << getJson({*validLedger, {}});
JLOG(j_.error()) << "built\n" << to_string(getJson({*builtLedger, {}}));
JLOG(j_.error()) << "valid\n" << to_string(getJson({*validLedger, {}}));

// Log all differences between built and valid ledgers
auto b = builtTx.begin();
Expand Down
7 changes: 4 additions & 3 deletions src/xrpld/app/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <xrpl/core/PerfLog.h>
#include <xrpl/crypto/csprng.h>
#include <xrpl/json/json_reader.h>
#include <xrpl/json/to_string.h>
#include <xrpl/ledger/AmendmentTable.h>
#include <xrpl/ledger/PendingSaves.h>
#include <xrpl/nodestore/DummyScheduler.h>
Expand Down Expand Up @@ -1424,7 +1425,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)

if (!config_->quiet())
{
JLOG(m_journal.fatal()) << "Startup RPC: " << jvCommand << std::endl;
JLOG(m_journal.fatal()) << "Startup RPC: " << to_string(jvCommand) << std::endl;
}

Resource::Charge loadType = Resource::feeReferenceRPC;
Expand All @@ -1447,7 +1448,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)

if (!config_->quiet())
{
JLOG(m_journal.fatal()) << "Result: " << jvResult << std::endl;
JLOG(m_journal.fatal()) << "Result: " << to_string(jvResult) << std::endl;
}
}

Expand Down Expand Up @@ -1690,7 +1691,7 @@ ApplicationImp::getLastFullLedger()
stream << "Failed on ledger";
Json::Value p;
addJson(p, {*ledger, nullptr, LedgerFill::full});
stream << p;
stream << to_string(p);
}

return {};
Expand Down
10 changes: 6 additions & 4 deletions src/xrpld/app/main/LoadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,16 @@ LoadManager::run()

if (app_.getJobQueue().isOverloaded())
{
JLOG(journal_.warn()) << "JobQueue: " << app_.getJobQueue().getJson(0);
JLOG(journal_.warn())
<< "JobQueue: " << to_string(app_.getJobQueue().getJson(0));
}
}
else
{
JLOG(journal_.fatal())
<< "Server stalled for " << timeSpentStalled.count() << " seconds.";
JLOG(journal_.fatal()) << "JobQueue: " << app_.getJobQueue().getJson(0);
JLOG(journal_.fatal())
<< "JobQueue: " << to_string(app_.getJobQueue().getJson(0));
}
}

Expand All @@ -138,7 +140,7 @@ LoadManager::run()
{
JLOG(journal_.fatal()) << "LogicError: Fatal server stall detected. Stalled time: "
<< timeSpentStalled.count() << "s";
JLOG(journal_.fatal()) << "JobQueue: " << app_.getJobQueue().getJson(0);
JLOG(journal_.fatal()) << "JobQueue: " << to_string(app_.getJobQueue().getJson(0));
LogicError("Fatal server stall detected");
}
}
Expand All @@ -148,7 +150,7 @@ LoadManager::run()
if (app_.getJobQueue().isOverloaded())
{
JLOG(journal_.info()) << "Raising local fee (JQ overload): "
<< app_.getJobQueue().getJson(0);
<< to_string(app_.getJobQueue().getJson(0));
change = app_.getFeeTrack().raiseLocalFee();
}
else
Expand Down
Loading