The server console

The server's console displays a ton of information and is a great place to know what is happening with the server.

The server logs various messages. These messages represent the lifecycle of the server.

Startup

On startup, the server displays certain information pertaining to the server.

$ mongod
2016-02-07T09:10:36.615-0600 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
2016-02-07T09:10:36.615-0600 I CONTROL  [initandlisten] MongoDB starting : pid=12592 port=27017 dbpath=C:\data\db\ 64-bit host=smarryboyina
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] db version v3.2.1
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] allocator: tcmalloc
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] modules: none
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] build environment:
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten]     distarch: x86_64
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten]     target_arch: x86_64
2016-02-07T09:10:36.625-0600 I CONTROL  [initandlisten] options: {}
2016-02-07T09:10:36.674-0600 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), 2016-02-07T09:10:38.095-0600 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-02-07T09:10:38.095-0600 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'

Connections

The server displays a lot of connection based messages.

Ready for connections

After startup, the server is ready to accept any new connections. This is reflected in the console.

2016-02-07T09:10:38.551-0600 I NETWORK  [initandlisten] waiting for connections on port 27017

Open connection

Upon connections, it displays the connection information.

2016-02-07T11:13:53.005-0600 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:58359 #1 (1 connection now open)
2016-02-07T11:14:06.225-0600 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:58360 #2 (2 connections now open)
2016-02-07T11:14:25.837-0600 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:58361 #3 (3 connections now open)

The above log is simulated by open 3 connections at three different consoles one after the other.

Technically, after a connection is open, anything can happen. The clients can pass commands, for instance.

Close connection

When a client ends its connection, for example by using the cntrl+c key combination, the server displays this information.

2016-02-07T11:15:44.117-0600 I NETWORK  [conn3] end connection 127.0.0.1:58361 (2 connections now open)

Commands

Commands are logged as well.

2016-02-07T09:33:21.962-0600 I COMMAND  [conn1] command test.myCollection command: insert { insert: "myCollection", documents: [ { _id: ObjectId('56b763c17123486ba4772ae8'), x: 1.0 } ], ordered: true } ninserted:1 keyUpdates:0 writeConflicts:0 numYields:0 reslen:25 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1 } } } protocol:op_command 215ms

Shutdown

If the server terminates unexpectedly or the user ends the server program, the shutdown report is logged.

2016-02-07T11:20:52.475-0600 I CONTROL  [thread1] Ctrl-C signal
2016-02-07T11:20:52.476-0600 I CONTROL  [consoleTerminate] got CTRL_C_EVENT, will terminate after current cmd ends
2016-02-07T11:20:52.477-0600 I FTDC     [consoleTerminate] Shutting down full-time diagnostic data capture
2016-02-07T11:20:52.490-0600 I CONTROL  [consoleTerminate] now exiting
2016-02-07T11:20:52.491-0600 I NETWORK  [consoleTerminate] shutdown: going to close listening sockets...
2016-02-07T11:20:52.491-0600 I NETWORK  [consoleTerminate] closing listening socket: 460
2016-02-07T11:20:52.491-0600 I NETWORK  [consoleTerminate] shutdown: going to flush diaglog...
2016-02-07T11:20:52.492-0600 I NETWORK  [consoleTerminate] shutdown: going to close sockets...
2016-02-07T11:20:52.493-0600 I STORAGE  [consoleTerminate] WiredTigerKVEngine shutting down
2016-02-07T11:20:52.495-0600 I NETWORK  [conn1] end connection 127.0.0.1:58359 (0 connections now open)
2016-02-07T11:20:53.007-0600 I STORAGE  [consoleTerminate] shutdown: removing fs lock...
2016-02-07T11:20:53.008-0600 I CONTROL  [consoleTerminate] dbexit:  rc: 12

In the above server log, the server got a Ctrl-C signal.

Identifiers

The logs show various identifiers. These specify a class of operation.

Idenitifier
I CONTROL
I -
I NETWORK
I STORAGE
I FTDC

Verbosity

The verbosity level can be increased by specifying the -v or the --verbose switch.

$ mongod --verbose vvvvv

This yields a very high level of verbose log of the activity on the server. Just give it a try. :)