Skip to content

Commit

Permalink
[#24725] YSQL: Make the connection manager log file name of the PG fo…
Browse files Browse the repository at this point in the history
…rmat

Summary:
Before this revision, the connection manager logs used to go in `ysql-conn-mgr.log` file in the tserver logs directory.

This revision updates the log file format to `ysqlconnmgr-YYYY-MM-DD_HHMMSS.log` format which is also used by PG.
Jira: DB-13804

Test Plan:
Jenkins: compile only
Manually tested with creating a cluster and checking the file name.

Reviewers: skumar, rbarigidad, mkumar

Reviewed By: skumar

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D39604
  • Loading branch information
dr0pdb committed Oct 30, 2024
1 parent 36d31ac commit 4c00d93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/yb/yql/ysql_conn_mgr_wrapper/ysql_conn_mgr_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,15 @@ void YsqlConnMgrConf::UpdateConfigFromGFlags() {

YsqlConnMgrConf::YsqlConnMgrConf(const std::string& data_path) {
data_dir_ = JoinPathSegments(data_path, "yb-data", "tserver");
log_file_ = JoinPathSegments(FLAGS_log_dir, "ysql-conn-mgr.log");
pid_file_ = JoinPathSegments(data_path, "yb-data", "tserver", "ysql-conn-mgr.pid");
ysql_pgconf_file_ = JoinPathSegments(data_path, "pg_data", "ysql_pg.conf");

// Generate the log file name based on the current time.
auto now = std::time(/* arg= */ nullptr);
auto* tm = std::localtime(&now);
char buffer[64];
buffer[strftime(buffer, sizeof(buffer), "ysqlconnmgr-%Y-%m-%d_%H%M%S.log", tm)] = 0;
log_file_ = JoinPathSegments(FLAGS_log_dir, buffer);

UpdateConfigFromGFlags();

Expand Down

0 comments on commit 4c00d93

Please sign in to comment.