<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:51 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-2697] Include elapsed time and request id when logging command execution</title>
                <link>https://jira.mongodb.org/browse/JAVA-2697</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;The driver currently logs: &lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Sending command {find : BsonString{value=&apos;mycollection&apos;}} to database mydb on connection [connectionId{localValue:13, serverValue:361425}] to server myserver:27017&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Command execution completed&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Relying on the logging framework to print the timestamps&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2017-12-06T19:05:17.780+0000 DEBUG : loggerName=&quot;org.mongodb.driver.protocol.command&quot; threadName=&quot;qtp1848125895-70&quot; txnId=&quot;f04394d3-cb7b-44e0-8381-49216e218103&quot; Sending command {find : BsonString{value=&apos;mycollection&apos;}} to database mydb on connection [connectionId{localValue:13, serverValue:361425}] to server myserver:27017&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2017-12-06T19:05:17.789+0000 DEBUG : loggerName=&quot;org.mongodb.driver.protocol.command&quot; threadName=&quot;qtp1848125895-70&quot; txnId=&quot;f04394d3-cb7b-44e0-8381-49216e218103&quot; Command execution completed&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and making forensics more difficult since scripts have to find the two related log messages and diff the timestamps.&lt;/p&gt;

&lt;p&gt;The driver could make this easier by logging the elapsed time itself:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Sending command {find : BsonString{value=&apos;mycollection&apos;}} to database mydb on connection [connectionId{localValue:13, serverValue:361425}] to server myserver:27017&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Command execution completed in xxx ms&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;It&apos;s also relying on the logging configuration to log the thread id, which is necessary to correlation the two log messages.  Logging a unique request id could fix that:&lt;/p&gt;


&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Sending command {find : BsonString{value=&apos;mycollection&apos;}} to database mydb on connection [connectionId{localValue:13, serverValue:361425}] with request id 101 to server myserver:27017 &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Command execution with request id 101 completed in xxx ms&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;This would also allow correlation of asynchronous command execution, where it&apos;s not possible to correlate these messages by thread id.&lt;/p&gt;

&lt;p&gt;As part of this work, the driver will also log exceptions that occur as part of the command execution.&lt;/p&gt;</description>
                <environment></environment>
        <key id="469984">JAVA-2697</key>
            <summary>Include elapsed time and request id when logging command execution</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="jeff.yemin@mongodb.com">Jeffrey Yemin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 8 Dec 2017 19:25:08 +0000</created>
                <updated>Sat, 28 Oct 2023 11:23:04 +0000</updated>
                            <resolved>Tue, 9 Jan 2018 14:21:50 +0000</resolved>
                                                    <fixVersion>3.7.0</fixVersion>
                                    <component>Monitoring</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1768864" author="xgen-internal-githook" created="Tue, 9 Jan 2018 14:20:16 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jeff Yemin&apos;, &apos;username&apos;: &apos;jyemin&apos;, &apos;email&apos;: &apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2697&quot; title=&quot;Include elapsed time and request id when logging command execution&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2697&quot;&gt;&lt;del&gt;JAVA-2697&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2698&quot; title=&quot;Include more of the command document when logging command execution&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2698&quot;&gt;&lt;del&gt;JAVA-2698&lt;/del&gt;&lt;/a&gt;: Log successful and failed command events, including elapsed time, request id, and truncated (at 1000 characters) JSON representation of the command.  Logs now look like this (against a 3.6 server)&lt;/p&gt;

&lt;p&gt;10:37:29.099 [cluster-ClusterId&lt;/p&gt;
{value=&apos;5a466138741fc252712a6d71&apos;, description=&apos;null&apos;}-127.0.0.1:27017] DEBUG org.mongodb.driver.protocol.command - Sending command &apos;{ &quot;ismaster&quot; : 1, &quot;$db&quot; : &quot;admin&quot; } ...&apos; with request id 4 to database admin on connection &lt;span class=&quot;error&quot;&gt;&amp;#91;connectionId{localValue:1, serverValue:1958}&amp;#93;&lt;/span&gt; to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.104 [cluster-ClusterId{value=&apos;5a466138741fc252712a6d71&apos;, description=&apos;null&apos;}
&lt;p&gt;-127.0.0.1:27017] DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 4 completed successfully in 22.44 ms on connection [connectionId&lt;/p&gt;
{localValue:1, serverValue:1958}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.154 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Sending command &apos;{ &quot;insert&quot; : &quot;test&quot;, &quot;ordered&quot; : true, &quot;writeConcern&quot; : &lt;/p&gt;
{ &quot;w&quot; : 0 }
&lt;p&gt;, &quot;$db&quot; : &quot;test&quot;, &quot;documents&quot; : [{ &quot;_id&quot; : &lt;/p&gt;
{ &quot;$oid&quot; : &quot;5a466139741fc252712a6d72&quot; }
&lt;p&gt;, &quot;bytes&quot; : { &quot;$binary&quot; : { &quot;base64&quot; : &quot;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ...&apos; with request id 8 to database test on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.154 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Execution of one-way command with request id 8 completed successfully in 24.02 ms on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.161 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Sending command &apos;{ &quot;ping&quot; : 1, &quot;$db&quot; : &quot;admin&quot;, &quot;lsid&quot; : { &quot;id&quot; : { &quot;$binary&quot; : &lt;/p&gt;
{ &quot;base64&quot; : &quot;1VaSnyegTCy9yXzgsmP0FQ==&quot;, &quot;subType&quot; : &quot;04&quot; }
&lt;p&gt; } } } ...&apos; with request id 9 to database admin on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.162 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 9 completed successfully in 1.46 ms on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.163 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Sending command &apos;{ &quot;unknown&quot; : 1, &quot;$db&quot; : &quot;admin&quot;, &quot;lsid&quot; : { &quot;id&quot; : { &quot;$binary&quot; : &lt;/p&gt;
{ &quot;base64&quot; : &quot;1VaSnyegTCy9yXzgsmP0FQ==&quot;, &quot;subType&quot; : &quot;04&quot; }
&lt;p&gt; } } } ...&apos; with request id 10 to database admin on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
10:37:29.175 &lt;span class=&quot;error&quot;&gt;&amp;#91;main&amp;#93;&lt;/span&gt; DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 10 failed to complete successfully in 5.34 ms on connection [connectionId&lt;/p&gt;
{localValue:2, serverValue:1959}
&lt;p&gt;] to server 127.0.0.1:27017&lt;br/&gt;
com.mongodb.MongoCommandException: Command failed with error 59: &apos;no such command: &apos;unknown&apos;, bad cmd: &apos;{ unknown: 1, $db: &quot;admin&quot;, lsid: &lt;/p&gt;
{ id: UUID(&quot;d556929f-27a0-4c2c-bdc9-7ce0b263f415&quot;) }
&lt;p&gt; }&apos;&apos; on server 127.0.0.1:27017. The full response is { &quot;operationTime&quot; : { &quot;$timestamp&quot; : &lt;/p&gt;
{ &quot;t&quot; : 1514556771, &quot;i&quot; : 1 }
&lt;p&gt; }, &quot;ok&quot; : 0.0, &quot;errmsg&quot; : &quot;no such command: &apos;unknown&apos;, bad cmd: &apos;{ unknown: 1, $db: \&quot;admin\&quot;, lsid: &lt;/p&gt;
{ id: UUID(\&quot;d556929f-27a0-4c2c-bdc9-7ce0b263f415\&quot;) }
&lt;p&gt; }&apos;&quot;, &quot;code&quot; : 59, &quot;codeName&quot; : &quot;CommandNotFound&quot; }&lt;br/&gt;
    at com.mongodb.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:164)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/a93299f7a9a18e9febabfd8445a24af0f8a8c194&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/a93299f7a9a18e9febabfd8445a24af0f8a8c194&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="149910">JAVA-1322</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="469994">JAVA-2698</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr906v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>