Dynamic log level adjustment for debug sessions
Dynamic logging adjustment can be performed during a debug session to facilitate issue resolution. A user of a software platform can initiate a debug session with a specified logging profile. The logging profile includes respective log levels for backend components of the software platform which only apply to server requests associated with the debug session. During the debug session, the user attempts to reproduce the issue which triggers corresponding server requests. The server determines whether a given server request is part of the debug session, and if so, dynamically adjusts the log level for actions associated with the server request. A debug session identifier for the debug session is inserted in log entries associated with the server request. After the debug session has concluded, server logs can be filtered by the debug session identifier to obtain a targeted set of log entries pertaining to the issue.
1 . A computer-implemented method comprising:
receiving a debug session configuration from a client application of a software platform, wherein the debug session configuration comprises an indication that a debug session is active and a logging profile for the debug session;
receiving a server request from the client application;
determining that the server request is part of the debug session;
adjusting a log level for actions associated with the server request in accordance with the logging profile; and
generating log entries for the actions associated with the server request at the adjusted log level, wherein generating the log entries includes inserting a debug session identifier in the respective log entries.
2 . The method of claim 1 , wherein:
the logging profile specifies respective log levels for one or more backend components of the software platform for actions associated with the debug session; and
adjusting the log level for the actions associated with the server request in accordance with the logging profile comprises adjusting current respective log levels of the one or more backend components to the respective log levels specified in the logging profile.
3 . The method of claim 2 , wherein:
the respective log levels for the one or more backend components specified in the logging profile are selected from the group consisting of an error log level, a warning log level, an info log level, a debug log level, and a custom log level; and
the debug log level is a higher log level than the info log level, the warning log level, and the error log level.
4 . The method of claim 1 , wherein:
the logging profile specifies a log level for one or more backend components of the software platform for actions associated with the debug session; and
adjusting the log level for the actions associated with the server request in accordance with the logging profile comprises increasing a current log level of the one or more backend components for actions associated with the debug session to a higher log level.
5 . The method of claim 1 , wherein the debug session identifier comprises a string of characters that uniquely identifies the debug session.
6 . The method of claim 1 , further comprising:
receiving one or more other server requests while the debug session is active;
determining that the one or more other server requests are not part of the debug session; and
responsive to determining that the one or more other server requests are not part of the debug session, not adjusting a log level for actions associated with the one or more other server requests in accordance with the logging profile.
7 . The method of claim 1 , further comprising:
after generating the log entries, storing the log entries in a central log storage, wherein the central log storage is configured to output the log entries in response to a request for log entries that include the debug session identifier.
8 . The method of claim 1 , further comprising:
after generating the log entries, storing the log entries in a file, wherein other log entries that do not include the debug session identifier are not stored in the file;
encrypting the file; and
outputting the encrypted file in response to a request for log entries that include the debug session identifier.
9 . The method of claim 1 , wherein:
the debug session identifier is generated for the debug session by a frontend component of the client application;
the debug session configuration comprises the debug session identifier;
the server request comprises the debug session identifier; and
determining that the server request is part of the debug session comprises determining that the server request comprises the debug session identifier.
10 . The method of claim 1 , wherein:
the server request comprises a debug flag; and
determining that the server request is part of the debug session comprises determining that the debug flag in the server request is set.
11 . The method of claim 1 , further comprising:
responsive to receiving the configuration, generating the debug session identifier; and
transmitting the debug session identifier to the client application.
12 . The method of claim 11 , wherein:
the configuration further comprises an indication of a user associated with the debug session;
the server request comprises an indication of a user associated with the server request and does not comprise the debug session identifier; and
determining that the server request is part of the debug session comprises determining that the user associated with the server request matches the user associated with the debug session.
13 . A computing system configured to host a software platform, comprising:
at least one hardware processor;
at least one memory coupled to the at least one hardware processor;
a client application;
a plurality of backend components;
a logger configured to generate log entries for actions performed by the backend components; and
one or more non-transitory computer-readable media having stored therein computer-executable instructions that, when executed by the computing system, cause the computing system to perform:
receiving a configuration for a debug session from the client application, wherein the configuration indicates that a debug session is active and specifies respective log levels for the backend components;
receiving a server request;
determining that the server request is part of the debug session;
at the logger, adjusting log levels for actions performed by the backend components in response to the server request to the respective log levels for the backend components; and
generating, using the logger, log entries for the actions performed by the backend components in response to the server request at the respective log levels for the backend components, wherein generating the log entries includes inserting a debug session identifier in the respective log entries.
14 . The system of claim 13 , wherein:
the debug session identifier comprises a string of characters that uniquely identifies the debug session.
15 . The system of claim 13 , wherein:
the client application comprises a frontend component;
the debug session identifier is generated for the debug session by the frontend component;
the configuration comprises the debug session identifier;
the server request comprises the debug session identifier; and
the presence of the debug session identifier in the server request serves as an indication that the server request is part of the debug session.
16 . The system of claim 13 , wherein:
the backend components comprise a debug session service; and
the debug session identifier is generated by the debug session service.
17 . The system of claim 16 , wherein:
the configuration further comprises an indication of a user associated with the debug session;
the server request comprises an indication of a user associated with the server request and does not comprise the debug session identifier; and
the user associated with the debug session matching the user associated with the server request serves as an indication that the server request is part of the debug session.
18 . One or more non-transitory computer-readable media comprising computer-executable instructions that, when executed by a computing system, cause the computing system to perform operations comprising:
receiving a request to initiate a debug session via a user interface of a client application of a software platform, wherein the request comprises configuration data for the debug session, and wherein the configuration data specifies respective log levels for components of a backend of the software platform;
responsive to the request to initiate the debug session:
generating a debug session identifier for the debug session; and
transmitting the configuration data and the debug session identifier to the backend of the software platform to initiate the debug session; and
during the debug session:
receiving an input via the user interface;
generating a server request based on the input;
modifying the server request to include an indication that the server request is associated with the debug session; and
transmitting the server request to the backend of the software platform.
19 . The computer-readable media of claim 18 , wherein modifying the server request to include the indication that the server request is associated with the debug session comprises at least one of the following:
modifying the server request to include the debug session identifier; or
setting a debug session flag in the server request.
20 . The computer-readable media of claim 18 , wherein the operations further comprise displaying the debug session identifier via the user interface.