Skip to content

Commit f9ac3d3

Browse files
author
Artyom Abakumov
committed
Print trace plugins in tracecmgr LIST output
1 parent f85ab73 commit f9ac3d3

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

doc/README.services_extension

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ List of existing trace sessions
131131
output
132132
text messages with list and state of trace sessions
133133
- Session ID: <number>
134-
- name: <string>
135-
- user: <string>
136-
- date: YYYY-MM-DD HH:NN:SS
137-
- flags: <string>
134+
- name: <string>
135+
- user: <string>
136+
- date: YYYY-MM-DD HH:NN:SS
137+
- flags: <string>
138+
- plugins: <string list>
138139

139140
"name" is trace session name and not printed if empty.
140141
"user" is creator user name

src/jrd/trace/TraceService.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ bool TraceSvcJrd::changeFlags(ULONG id, int setFlags, int clearFlags)
219219

220220
void TraceSvcJrd::listSessions()
221221
{
222+
// Do not use value from Config::getDefaultConfig() because
223+
// tracemgr will reread config in embedded mode
224+
constexpr const char* defaultPlugins = "<default>";
225+
222226
m_svc.started();
223227

224228
// Writing into service when storage is locked could lead to deadlock,
@@ -235,12 +239,12 @@ void TraceSvcJrd::listSessions()
235239
{
236240
m_svc.printf(false, "\nSession ID: %d\n", session.ses_id);
237241
if (!session.ses_name.empty()) {
238-
m_svc.printf(false, " name: %s\n", session.ses_name.c_str());
242+
m_svc.printf(false, " name: %s\n", session.ses_name.c_str());
239243
}
240-
m_svc.printf(false, " user: %s\n", session.ses_user.c_str());
244+
m_svc.printf(false, " user: %s\n", session.ses_user.c_str());
241245

242246
const struct tm* t = localtime(&session.ses_start);
243-
m_svc.printf(false, " date: %04d-%02d-%02d %02d:%02d:%02d\n",
247+
m_svc.printf(false, " date: %04d-%02d-%02d %02d:%02d:%02d\n",
244248
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
245249
t->tm_hour, t->tm_min, t->tm_sec);
246250

@@ -266,7 +270,10 @@ void TraceSvcJrd::listSessions()
266270
if (session.ses_flags & trs_log_full) {
267271
flags += ", log full";
268272
}
269-
m_svc.printf(false, " flags: %s\n", flags.c_str());
273+
m_svc.printf(false, " flags: %s\n", flags.c_str());
274+
275+
const char* pluginsList = session.getPluginsList();
276+
m_svc.printf(false, " plugins: %s\n", pluginsList ? pluginsList : defaultPlugins);
270277
}
271278
}
272279
}

0 commit comments

Comments
 (0)