Skip to content

Commit 0f562ab

Browse files
DOCSP-47122-disable-logging (#381)
* init * WIP * first draft * add section to re-enable logging * edits * review feedback and consistency
1 parent 25516ea commit 0f562ab

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

source/includes/list-table-shell-properties.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
- Default
88
- Description
99

10+
* - ``disableLogging``
11+
- boolean
12+
- ``false``
13+
- Specifies whether |mdb-shell| writes log entries.
14+
1015
* - ``displayBatchSize``
1116
- integer
1217
- 20

source/logs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ automatically deletes log files older than 30 days.
6969
.. toctree::
7070
:titlesonly:
7171

72+
Disable Logging </logs/disable>
7273
Specify Log Location <logs/location>
7374
Write Custom Log Entries <logs/custom-entries>

source/logs/disable.txt

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.. _mongosh-logs-disable:
2+
3+
===============
4+
Disable Logging
5+
===============
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
To specify whether |mdb-shell| writes log messages, use the
14+
``disableLogging`` configuration option. Logging is enabled by default.
15+
16+
About this Task
17+
---------------
18+
19+
When you toggle logging, the change affects the current |mdb-shell|
20+
session. You don't need to start a new session for the change to take
21+
effect.
22+
23+
Before you Begin
24+
----------------
25+
26+
To check if logging is currently disabled, run the following command:
27+
28+
.. code-block:: javascript
29+
30+
config.get("disableLogging")
31+
32+
- If the command returns ``true``, logging is disabled.
33+
- If the command returns ``false``, logging is enabled.
34+
35+
Steps
36+
-----
37+
38+
You can set the ``disableLogging`` configuration option with the
39+
:ref:`configuration API <configure-settings-api>` or a
40+
:ref:`configuration file <configure-settings-global>`.
41+
42+
Disable Logging with the Configuration API
43+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44+
45+
The following command uses the config API to disable logging for
46+
|mdb-shell|:
47+
48+
.. io-code-block::
49+
:copyable: true
50+
51+
.. input::
52+
:language: javascript
53+
54+
config.set("disableLogging", true)
55+
56+
.. output::
57+
:language: javascript
58+
59+
Setting "disableLogging" has been changed
60+
61+
Disable Logging with a Configuration File
62+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
64+
The following configuration file disables logging for |mdb-shell|:
65+
66+
.. code-block:: yaml
67+
68+
mongosh:
69+
disableLogging: true
70+
71+
Re-Enable Logging
72+
~~~~~~~~~~~~~~~~~
73+
74+
To enable logging, set ``disableLogging`` to ``false``. You can perform
75+
this action through the config API or configuration file.

0 commit comments

Comments
 (0)