@@ -1597,6 +1597,13 @@ void ConfigCmd::ConfigGet(std::string& ret) {
1597
1597
EncodeNumber (&config_body, g_pika_conf->log_retention_time ());
1598
1598
}
1599
1599
1600
+ if (pstd::stringmatch (pattern.data (), " log-net-activities" , 1 ) != 0 ) {
1601
+ elements += 2 ;
1602
+ EncodeString (&config_body, " log-net-activities" );
1603
+ auto output_str = g_pika_conf->log_net_activities () ? " yes" : " no" ;
1604
+ EncodeString (&config_body, output_str);
1605
+ }
1606
+
1600
1607
if (pstd::stringmatch (pattern.data (), " thread-num" , 1 ) != 0 ) {
1601
1608
elements += 2 ;
1602
1609
EncodeString (&config_body, " thread-num" );
@@ -2167,12 +2174,6 @@ void ConfigCmd::ConfigGet(std::string& ret) {
2167
2174
EncodeString (&config_body, g_pika_conf->enable_blob_garbage_collection () ? " yes" : " no" );
2168
2175
}
2169
2176
2170
- if (pstd::stringmatch (pattern.data (), " loglevel" , 1 ) != 0 ) {
2171
- elements += 2 ;
2172
- EncodeString (&config_body, " loglevel" );
2173
- EncodeString (&config_body, g_pika_conf->log_level ());
2174
- }
2175
-
2176
2177
if (pstd::stringmatch (pattern.data (), " min-blob-size" , 1 ) != 0 ) {
2177
2178
elements += 2 ;
2178
2179
EncodeString (&config_body, " min-blob-size" );
@@ -2492,6 +2493,15 @@ void ConfigCmd::ConfigSet(std::shared_ptr<DB> db) {
2492
2493
g_pika_conf->SetSlowlogMaxLen (static_cast <int >(ival));
2493
2494
g_pika_server->SlowlogTrim ();
2494
2495
res_.AppendStringRaw (" +OK\r\n " );
2496
+ } else if (set_item == " log-net-activities" ) {
2497
+ if (value != " yes" && value != " no" ) {
2498
+ res_.AppendStringRaw (" -ERR Invalid argument \' " + value +
2499
+ " \' for CONFIG SET 'log-net-activities', only yes or no is valid\r\n " );
2500
+ return ;
2501
+ }
2502
+ g_pika_conf->SetLogNetActivities (value);
2503
+ g_pika_server->SetLogNetActivities (value == " yes" );
2504
+ res_.AppendStringRaw (" +OK\r\n " );
2495
2505
} else if (set_item == " max-cache-statistic-keys" ) {
2496
2506
if ((pstd::string2int (value.data (), value.size (), &ival) == 0 ) || ival < 0 ) {
2497
2507
res_.AppendStringRaw (" -ERR Invalid argument \' " + value + " \' for CONFIG SET 'max-cache-statistic-keys'\r\n " );
@@ -3345,7 +3355,9 @@ void QuitCmd::DoInitial() {
3345
3355
3346
3356
void QuitCmd::Do () {
3347
3357
res_.SetRes (CmdRes::kOk );
3348
- LOG (INFO) << " QutCmd will close connection " << GetConn ()->String ();
3358
+ if (g_pika_conf->log_net_activities ()) {
3359
+ LOG (INFO) << " QuitCmd will close connection " << GetConn ()->String ();
3360
+ }
3349
3361
GetConn ()->SetClose (true );
3350
3362
}
3351
3363
0 commit comments