Skip to content

Commit 12f38b4

Browse files
committed
HPCC-33885 WIP
Signed-off-by: Dave Streeter <[email protected]>
1 parent 7064a80 commit 12f38b4

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

system/jlib/jlog.cpp

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,26 +2391,40 @@ struct LogFormatChangedDetails
23912391
};
23922392
LogFormatChangedDetails hasLogFormatChanged(const Owned<IPropertyTree> &logConfig)
23932393
{
2394+
UWARNLOG("DJPS hasLogFormatChanged() called");
23942395
LogFormatChangedDetails logFormatChanged{};
23952396

23962397
if (logConfig->hasProp(logFormatAtt))
23972398
{
2398-
String logConfigFormat = logConfig->queryProp(logFormatAtt);
2399+
StringAttr logConfigFormat(logConfig->queryProp(logFormatAtt));
2400+
UWARNLOG("DJPS hasLogFormatChanged() logConfigFormat=%s", logConfigFormat.str());
23992401
logFormatChanged.logFormat.set(logConfigFormat.str());
2400-
if (logConfigFormat.compareTo("xml") == 0)
2402+
if (streq(logConfigFormat,"xml"))
24012403
{
2404+
UWARNLOG("DJPS hasLogFormatChanged() xml");
24022405
if (theStderrHandler->queryFormatType() != LOGFORMAT_xml)
2406+
{
2407+
UWARNLOG("DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true");
24032408
logFormatChanged.formatChangeDetected = true;
2409+
}
24042410
}
2405-
else if (logConfigFormat.compareTo("json") == 0)
2411+
else if (streq(logConfigFormat,"json"))
24062412
{
2413+
UWARNLOG("DJPS hasLogFormatChanged() json");
24072414
if (theStderrHandler->queryFormatType() != LOGFORMAT_json)
2415+
{
2416+
UWARNLOG("DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true");
24082417
logFormatChanged.formatChangeDetected = true;
2418+
}
24092419
}
2410-
else if (logConfigFormat.compareTo("table") == 0)
2420+
else if (streq(logConfigFormat,"table"))
24112421
{
2422+
UWARNLOG("DJPS hasLogFormatChanged() table");
24122423
if (theStderrHandler->queryFormatType() != LOGFORMAT_table)
2424+
{
2425+
UWARNLOG("DJPS hasLogFormatChanged() logFormatChanged.formatChangeDetected = true");
24132426
logFormatChanged.formatChangeDetected = true;
2427+
}
24142428
}
24152429
else
24162430
LOG(MCoperatorWarning, "JLog: Invalid log format configuration detected '%s'!", logConfigFormat.str());
@@ -2421,18 +2435,24 @@ LogFormatChangedDetails hasLogFormatChanged(const Owned<IPropertyTree> &logConfi
24212435

24222436
bool configureHandlers(bool rejectOnTheFlyChanges)
24232437
{
2438+
UWARNLOG("DJPS configureHandlers(%s)", boolToStr(rejectOnTheFlyChanges));
24242439
Owned<IPropertyTree> logConfig = getComponentConfigSP()->getPropTree("logging");
24252440
if (logConfig)
24262441
{
24272442
if (logConfig->getPropBool(logDisabledAtt, false))
24282443
{
24292444
removeLog();
2445+
UWARNLOG("DJPS logging disabled");
24302446
return false;
24312447
}
24322448

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+
}
24362456

24372457
if (logConfig->hasProp(logFieldsAtt))
24382458
{
@@ -2477,10 +2497,14 @@ auto updateConfigFunc = [](const IPropertyTree *oldComponentConfiguration, const
24772497
static CConfigUpdateHook configUpdateHook;
24782498
void setupContainerizedLogMsgHandler()
24792499
{
2500+
UWARNLOG("DJPS setupContainerizedLogMsgHandler() called");
24802501
configUpdateHook.installOnce(updateConfigFunc, false);
24812502

24822503
if (!configureHandlers(false)) // false return means that logging is disabled
2504+
{
2505+
UWARNLOG("DJPS !configureHandlers(false)");
24832506
return;
2507+
}
24842508

24852509
Owned<IPropertyTree> logConfig = getComponentConfigSP()->getPropTree("logging");
24862510
if (logConfig)
@@ -2491,24 +2515,30 @@ void setupContainerizedLogMsgHandler()
24912515
bool newFormatDetected = false;
24922516
if (streq(logFormatChanged.logFormat.str(), "xml"))
24932517
{
2518+
UWARNLOG("DJPS existing log format is xml");
24942519
if (theStderrHandler->queryFormatType() != LOGFORMAT_xml)
24952520
{
2521+
UWARNLOG("DJPS set newFormatDetected = true");
24962522
newFormatDetected = true;
24972523
theStderrHandler = new HandleLogMsgHandlerXML(stderr, MSGFIELD_STANDARD);
24982524
}
24992525
}
25002526
else if (streq(logFormatChanged.logFormat.str(), "json"))
25012527
{
2528+
UWARNLOG("DJPS existing log format is json");
25022529
if (theStderrHandler->queryFormatType() != LOGFORMAT_json)
25032530
{
2531+
UWARNLOG("DJPS set newFormatDetected = true");
25042532
newFormatDetected = true;
25052533
theStderrHandler = new HandleLogMsgHandlerJSON(stderr, MSGFIELD_STANDARD);
25062534
}
25072535
}
25082536
else if (streq(logFormatChanged.logFormat.str(), "table"))
25092537
{
2538+
UWARNLOG("DJPS existing log format is table");
25102539
if (theStderrHandler->queryFormatType() != LOGFORMAT_table)
25112540
{
2541+
UWARNLOG("DJPS set newFormatDetected = true");
25122542
newFormatDetected = true;
25132543
theStderrHandler = new HandleLogMsgHandlerTable(stderr, MSGFIELD_STANDARD);
25142544
}
@@ -2517,7 +2547,10 @@ void setupContainerizedLogMsgHandler()
25172547
LOG(MCoperatorWarning, "JLog: Invalid log format configuration detected '%s'!", logFormatChanged.logFormat.str());
25182548

25192549
if (newFormatDetected)
2550+
{
2551+
UWARNLOG("DJPS processing newFormatDetected = true");
25202552
theManager->resetMonitors();
2553+
}
25212554
}
25222555

25232556
unsigned queueLen = logConfig->getPropInt(logQueueLenAtt, queueLenDefault);

0 commit comments

Comments
 (0)