Database connection logging

Specifying the database connection (DB.Connects) log entry type turns on logging of database connections (connects and disconnects) in the client log. (For information on configuring and enabling logging, see Logging infrastructure overview.) The log messages include database name and user ID number. Information is logged at logging level 2 (basic) and higher.

Log entries generated for this type contain the tag CONN. An example of database connection logging messages (with headers suppressed) is shown:

CONN           Database sports2020 Options:  (12699)
CONN           Connected to database sports2020, user number 5. (9543)
...
CONN           Disconnecting from database sports2020, user number 5. (9545)

The default for the application server is ASPlumbing and DB.Connects. Generally, these log entry types are together in an application server log. For example:

-- Log entry types activated: ASPlumbing,DB.Connects
AS Starting MSAS Session for oepas1.
AS MSAS Session Startup. (5473)
MSAS Incremented connection count for sports2020 (sports2020): 1
CONN           Database sports2020 Options:  (12699)
CONN           Connected to database sports2020, user number 5. (9543)
...
MSAS Agent Shutting Down. Status: 4020
MSAS Worker Thread exiting. Number: 5, Status: 0
MSAS Disconnecting resource manager sports2020 (sports2020).
CONN           Disconnecting from database sports2020, user number 5. (9545)
MSAS Removed connection sports2020 from session 2.
MSAS Agent Shutdown Complete.

Logging for database connection control parameters

If you are using database connection control parameters (-dbalt1 or -dbalt2) to specify alternate databases to connect to, additional messages are logged. (For more information see Learn about automatic database reconnect.)

At logging level 2 (basic) or higher, upon successful connection to an alternate database, a message is logged indicating the connection is to an alternate:
CONN           Connected to alternate database alt2
At logging level 3 (verbose) or higher, messages are logged showing the attempted connections:
CONN           Attempting to connect to database prim (primary)
CONN           Failed to connect to database prim
CONN           Failover: attempting to connect to database alt1 (-dbalt1)
CONN           Failed to connect to database alt1
CONN           Failover: attempting to connect to database alt2 (-dbalt2)
At logging level 3 or higher, an additional message is logged if the connection set (primary and alternates) is tried again. The number of retries of the connection set, and the pause in between, is controlled by the -retryConnect and -retryConnectPause settings. For example:
CONN           Pausing 3 seconds between connection attempts
At logging level 3 or higher, if the session is restarted due to an unhandled STOP condition, for a GUI or character-mode client, and -autoReconnect is enabled, a message is logged:
CONN           Session restart: attempting to reconnect any disconnected databases