From bd38c69f5e6dc3136d20505d49f034c0927bf3e2 Mon Sep 17 00:00:00 2001 From: Samy Lanka Date: Wed, 12 Sep 2018 16:08:54 -0400 Subject: SERVER-36726 Log SessionID when we start a session in the shell and Log TxnNumber when we start a transaction --- src/mongo/shell/mongo.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mongo/shell/mongo.js') diff --git a/src/mongo/shell/mongo.js b/src/mongo/shell/mongo.js index 416416d8b3f..4db8924a8ec 100644 --- a/src/mongo/shell/mongo.js +++ b/src/mongo/shell/mongo.js @@ -441,7 +441,15 @@ Mongo.prototype.startSession = function startSession(options = {}) { if (!options.hasOwnProperty("retryWrites") && this.hasOwnProperty("_retryWrites")) { options.retryWrites = this._retryWrites; } - return new DriverSession(this, options); + const newDriverSession = new DriverSession(this, options); + + // Only log this message if we are running a test + if (typeof TestData === "object" && TestData.testName) { + jsTest.log("New session started with sessionID: " + + tojson(newDriverSession.getSessionId())); + } + + return newDriverSession; }; Mongo.prototype._getDefaultSession = function getDefaultSession() { -- cgit v1.2.1