@@ -2391,26 +2391,40 @@ struct LogFormatChangedDetails
2391
2391
};
2392
2392
LogFormatChangedDetails hasLogFormatChanged (const Owned<IPropertyTree> &logConfig)
2393
2393
{
2394
+ UWARNLOG (" DJPS hasLogFormatChanged() called" );
2394
2395
LogFormatChangedDetails logFormatChanged{};
2395
2396
2396
2397
if (logConfig->hasProp (logFormatAtt))
2397
2398
{
2398
- String logConfigFormat = logConfig->queryProp (logFormatAtt);
2399
+ StringAttr logConfigFormat (logConfig->queryProp (logFormatAtt));
2400
+ UWARNLOG (" DJPS hasLogFormatChanged() logConfigFormat=%s" , logConfigFormat.str ());
2399
2401
logFormatChanged.logFormat .set (logConfigFormat.str ());
2400
- if (logConfigFormat. compareTo ( " xml" ) == 0 )
2402
+ if (streq (logConfigFormat, " xml" ))
2401
2403
{
2404
+ UWARNLOG (" DJPS hasLogFormatChanged() xml" );
2402
2405
if (theStderrHandler->queryFormatType () != LOGFORMAT_xml)
2406
+ {
2407
+ UWARNLOG (" DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true" );
2403
2408
logFormatChanged.formatChangeDetected = true ;
2409
+ }
2404
2410
}
2405
- else if (logConfigFormat. compareTo ( " json" ) == 0 )
2411
+ else if (streq (logConfigFormat, " json" ))
2406
2412
{
2413
+ UWARNLOG (" DJPS hasLogFormatChanged() json" );
2407
2414
if (theStderrHandler->queryFormatType () != LOGFORMAT_json)
2415
+ {
2416
+ UWARNLOG (" DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true" );
2408
2417
logFormatChanged.formatChangeDetected = true ;
2418
+ }
2409
2419
}
2410
- else if (logConfigFormat. compareTo ( " table" ) == 0 )
2420
+ else if (streq (logConfigFormat, " table" ))
2411
2421
{
2422
+ UWARNLOG (" DJPS hasLogFormatChanged() table" );
2412
2423
if (theStderrHandler->queryFormatType () != LOGFORMAT_table)
2424
+ {
2425
+ UWARNLOG (" DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true" );
2413
2426
logFormatChanged.formatChangeDetected = true ;
2427
+ }
2414
2428
}
2415
2429
else
2416
2430
LOG (MCoperatorWarning, " JLog: Invalid log format configuration detected '%s'!" , logConfigFormat.str ());
@@ -2421,18 +2435,24 @@ LogFormatChangedDetails hasLogFormatChanged(const Owned<IPropertyTree> &logConfi
2421
2435
2422
2436
bool configureHandlers (bool rejectOnTheFlyChanges)
2423
2437
{
2438
+ UWARNLOG (" DJPS configureHandlers(%s)" , boolToStr (rejectOnTheFlyChanges));
2424
2439
Owned<IPropertyTree> logConfig = getComponentConfigSP ()->getPropTree (" logging" );
2425
2440
if (logConfig)
2426
2441
{
2427
2442
if (logConfig->getPropBool (logDisabledAtt, false ))
2428
2443
{
2429
2444
removeLog ();
2445
+ UWARNLOG (" DJPS logging disabled" );
2430
2446
return false ;
2431
2447
}
2432
2448
2433
- LogFormatChangedDetails logFormatChanged = hasLogFormatChanged (logConfig);
2434
- if (rejectOnTheFlyChanges && logFormatChanged.formatChangeDetected )
2435
- UWARNLOG (" JLog: Ignoring log format configuration change on the fly is not supported in a containerized environment" );
2449
+ if (rejectOnTheFlyChanges)
2450
+ {
2451
+ UWARNLOG (" DJPS checking logformat change" );
2452
+ LogFormatChangedDetails logFormatChanged = hasLogFormatChanged (logConfig);
2453
+ if (logFormatChanged.formatChangeDetected )
2454
+ UWARNLOG (" JLog: Ignoring log format configuration change on the fly is not supported in a containerized environment" );
2455
+ }
2436
2456
2437
2457
if (logConfig->hasProp (logFieldsAtt))
2438
2458
{
@@ -2477,10 +2497,14 @@ auto updateConfigFunc = [](const IPropertyTree *oldComponentConfiguration, const
2477
2497
static CConfigUpdateHook configUpdateHook;
2478
2498
void setupContainerizedLogMsgHandler ()
2479
2499
{
2500
+ UWARNLOG (" DJPS setupContainerizedLogMsgHandler() called" );
2480
2501
configUpdateHook.installOnce (updateConfigFunc, false );
2481
2502
2482
2503
if (!configureHandlers (false )) // false return means that logging is disabled
2504
+ {
2505
+ UWARNLOG (" DJPS !configureHandlers(false)" );
2483
2506
return ;
2507
+ }
2484
2508
2485
2509
Owned<IPropertyTree> logConfig = getComponentConfigSP ()->getPropTree (" logging" );
2486
2510
if (logConfig)
@@ -2491,24 +2515,30 @@ void setupContainerizedLogMsgHandler()
2491
2515
bool newFormatDetected = false ;
2492
2516
if (streq (logFormatChanged.logFormat .str (), " xml" ))
2493
2517
{
2518
+ UWARNLOG (" DJPS existing log format is xml" );
2494
2519
if (theStderrHandler->queryFormatType () != LOGFORMAT_xml)
2495
2520
{
2521
+ UWARNLOG (" DJPS set newFormatDetected = true" );
2496
2522
newFormatDetected = true ;
2497
2523
theStderrHandler = new HandleLogMsgHandlerXML (stderr, MSGFIELD_STANDARD);
2498
2524
}
2499
2525
}
2500
2526
else if (streq (logFormatChanged.logFormat .str (), " json" ))
2501
2527
{
2528
+ UWARNLOG (" DJPS existing log format is json" );
2502
2529
if (theStderrHandler->queryFormatType () != LOGFORMAT_json)
2503
2530
{
2531
+ UWARNLOG (" DJPS set newFormatDetected = true" );
2504
2532
newFormatDetected = true ;
2505
2533
theStderrHandler = new HandleLogMsgHandlerJSON (stderr, MSGFIELD_STANDARD);
2506
2534
}
2507
2535
}
2508
2536
else if (streq (logFormatChanged.logFormat .str (), " table" ))
2509
2537
{
2538
+ UWARNLOG (" DJPS existing log format is table" );
2510
2539
if (theStderrHandler->queryFormatType () != LOGFORMAT_table)
2511
2540
{
2541
+ UWARNLOG (" DJPS set newFormatDetected = true" );
2512
2542
newFormatDetected = true ;
2513
2543
theStderrHandler = new HandleLogMsgHandlerTable (stderr, MSGFIELD_STANDARD);
2514
2544
}
@@ -2517,7 +2547,10 @@ void setupContainerizedLogMsgHandler()
2517
2547
LOG (MCoperatorWarning, " JLog: Invalid log format configuration detected '%s'!" , logFormatChanged.logFormat .str ());
2518
2548
2519
2549
if (newFormatDetected)
2550
+ {
2551
+ UWARNLOG (" DJPS processing newFormatDetected = true" );
2520
2552
theManager->resetMonitors ();
2553
+ }
2521
2554
}
2522
2555
2523
2556
unsigned queueLen = logConfig->getPropInt (logQueueLenAtt, queueLenDefault);
0 commit comments