Skip to content

Commit 9ad9d66

Browse files
committed
1. Add missing override
2. Add missing virual 3. Add updateStdErrLogHandler call to setupContainerizedLogMsgHandler to ensure config changes implemented. 4. Add missing extern jlib_decl 5. Change LOGFORMAT_undefined to LOGFORMAT_table 6. Rename hasLogFormatChanged to getConfigHandlerFormat 7. Remove configureHandlers as not coded Signed-off-by: Dave Streeter <[email protected]>
1 parent 28782b7 commit 9ad9d66

File tree

5 files changed

+91
-90
lines changed

5 files changed

+91
-90
lines changed

system/jlib/jdebug.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4311,23 +4311,23 @@ class UserMetricMsgHandler : public CInterface, implements ILogMsgHandler, imple
43114311
}
43124312

43134313
// interface ILogMsgHandler
4314-
virtual void handleMessage(const LogMsg & msg __attribute__((unused))) { counter++; }
4315-
virtual bool needsPrep() const { return false; }
4316-
virtual void prep() {}
4317-
virtual unsigned queryMessageFields() const { return MSGFIELD_detail; }
4318-
virtual void setMessageFields(unsigned _fields __attribute__((unused)) = MSGFIELD_all) {}
4319-
virtual void addToPTree(IPropertyTree * parent __attribute__((unused))) const {}
4320-
virtual int flush() { return 0; }
4321-
virtual bool getLogName(StringBuffer &name __attribute__((unused))) const { return false; }
4322-
virtual offset_t getLogPosition(StringBuffer &logFileName __attribute__((unused))) const { return 0; };
4314+
virtual void handleMessage(const LogMsg & msg __attribute__((unused))) override { counter++; }
4315+
virtual bool needsPrep() const override { return false; }
4316+
virtual void prep() override {}
4317+
virtual unsigned queryMessageFields() const override { return MSGFIELD_detail; }
4318+
virtual void setMessageFields(unsigned _fields __attribute__((unused)) = MSGFIELD_all) override {}
4319+
virtual void addToPTree(IPropertyTree * parent __attribute__((unused))) const override {}
4320+
virtual int flush() override { return 0; }
4321+
virtual bool getLogName(StringBuffer &name __attribute__((unused))) const override { return false; }
4322+
virtual offset_t getLogPosition(StringBuffer &logFileName __attribute__((unused))) const override { return 0; };
43234323
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
43244324

43254325
// interface IUserMetric
4326-
virtual unsigned __int64 queryCount() const { return counter; }
4327-
virtual const char *queryName() const { return metricName; }
4328-
virtual const char *queryMatchString() const { return regex; }
4329-
virtual void inc() { counter++; }
4330-
virtual void reset() { counter = 0; }
4326+
virtual unsigned __int64 queryCount() const override { return counter; }
4327+
virtual const char *queryName() const override { return metricName; }
4328+
virtual const char *queryMatchString() const override { return regex; }
4329+
virtual void inc() override { counter++; }
4330+
virtual void reset() override { counter = 0; }
43314331
};
43324332

43334333
jlib_decl IUserMetric *createUserMetric(const char *name, const char *matchString)

system/jlib/jlog.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,7 @@ static constexpr bool useSysLogDefault = false;
23792379

23802380
// returns LOGFORMAT_undefined if format has not changed
23812381
// NB: returns LOGFORMAT_table if no format specified (i.e. this is the default)
2382-
LogHandlerFormat hasLogFormatChanged(const IPropertyTree *logConfig)
2382+
LogHandlerFormat getConfigHandlerFormat(const IPropertyTree *logConfig)
23832383
{
23842384
LogHandlerFormat currentFormat = theStderrHandler->queryFormatType();
23852385
LogHandlerFormat newFormat{LOGFORMAT_undefined};
@@ -2442,7 +2442,7 @@ static void loggingSetupUpdate(const IPropertyTree *oldComponentConfiguration, c
24422442
return;
24432443
}
24442444

2445-
LogHandlerFormat newFormat = hasLogFormatChanged(logConfig);
2445+
LogHandlerFormat newFormat = getConfigHandlerFormat(logConfig);
24462446
if (newFormat != LOGFORMAT_undefined)
24472447
{
24482448
OWARNLOG("JLog: Ignoring log format configuration change on the fly, as it is not supported in a containerized environment");
@@ -2463,7 +2463,7 @@ void setupContainerizedLogMsgHandler()
24632463
removeLog();
24642464
return; // NB: can't be reenabled dynamically via an update at present
24652465
}
2466-
LogHandlerFormat newFormat = hasLogFormatChanged(logConfig); // NB: theStderrHandler is initially setup in MODULE_INIT
2466+
LogHandlerFormat newFormat = getConfigHandlerFormat(logConfig); // NB: theStderrHandler is initially setup in MODULE_INIT
24672467
if (newFormat != LOGFORMAT_undefined)
24682468
{
24692469
// NB: old theStderrHandler leaks, should be fixed by separate PR.
@@ -2516,6 +2516,8 @@ void setupContainerizedLogMsgHandler()
25162516
thePostMortemHandler = new PostMortemLogMsgHandler(portMortemFileBase, postMortemLines, MSGFIELD_STANDARD);
25172517
queryLogMsgManager()->addMonitor(thePostMortemHandler, getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, TopDetail));
25182518
}
2519+
2520+
updateStdErrLogHandler(logConfig);
25192521
}
25202522
configUpdateHook.installOnce(loggingSetupUpdate, false);
25212523
}

system/jlib/jlog.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,6 @@ extern jlib_decl ILogMsgHandler * queryStderrLogMsgHandler();
914914
extern jlib_decl ILogMsgHandler * queryPostMortemLogMsgHandler();
915915
extern jlib_decl bool copyPostMortemLogging(const char *target, bool clear);
916916
extern jlib_decl void setupContainerizedLogMsgHandler();
917-
bool configureHandlers(bool rejectOnTheFlyChanges);
918917

919918
//extern jlib_decl ILogMsgManager * createLogMsgManager(); // use with care! (needed by mplog listener facility)
920919

system/jlib/jlog.ipp

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,10 @@ class HandleLogMsgHandlerJSON : implements HandleLogMsgHandler, public CInterfac
451451
public:
452452
HandleLogMsgHandlerJSON(FILE * _handle, unsigned _fields) : HandleLogMsgHandler(_handle, _fields) {}
453453
IMPLEMENT_IINTERFACE;
454-
void handleMessage(const LogMsg & msg) override;
455-
bool needsPrep() const override { return false; }
456-
void prep() override {}
457-
void addToPTree(IPropertyTree * tree) const override;
454+
virtual void handleMessage(const LogMsg & msg) override;
455+
virtual bool needsPrep() const override { return false; }
456+
virtual void prep() override {}
457+
virtual void addToPTree(IPropertyTree * tree) const override;
458458
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_json; };
459459
};
460460

@@ -463,10 +463,10 @@ class HandleLogMsgHandlerXML : implements HandleLogMsgHandler, public CInterface
463463
public:
464464
HandleLogMsgHandlerXML(FILE * _handle, unsigned _fields) : HandleLogMsgHandler(_handle, _fields) {}
465465
IMPLEMENT_IINTERFACE;
466-
void handleMessage(const LogMsg & msg) override;
467-
bool needsPrep() const override { return false; }
468-
void prep() override {}
469-
void addToPTree(IPropertyTree * tree) const override;
466+
virtual void handleMessage(const LogMsg & msg) override;
467+
virtual bool needsPrep() const override { return false; }
468+
virtual void prep() override {}
469+
virtual void addToPTree(IPropertyTree * tree) const override;
470470
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_xml; };
471471
};
472472

@@ -475,10 +475,10 @@ class HandleLogMsgHandlerTable : implements HandleLogMsgHandler, public CInterfa
475475
public:
476476
HandleLogMsgHandlerTable(FILE * _handle, unsigned _fields) : HandleLogMsgHandler(_handle, _fields), prepped(false) {}
477477
IMPLEMENT_IINTERFACE;
478-
void handleMessage(const LogMsg & msg) override;
479-
bool needsPrep() const override { return !prepped; }
480-
void prep() override { CriticalBlock block(crit); LogMsg::fprintTableHead(handle, messageFields); prepped = true; }
481-
void addToPTree(IPropertyTree * tree) const override;
478+
virtual void handleMessage(const LogMsg & msg) override;
479+
virtual bool needsPrep() const override { return !prepped; }
480+
virtual void prep() override { CriticalBlock block(crit); LogMsg::fprintTableHead(handle, messageFields); prepped = true; }
481+
virtual void addToPTree(IPropertyTree * tree) const override;
482482
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_table; };
483483
private:
484484
bool prepped;
@@ -491,11 +491,11 @@ class FileLogMsgHandler : public ILogMsgHandler
491491
public:
492492
FileLogMsgHandler(const char * _filename, const char * _headerText = 0, unsigned _fields = MSGFIELD_all, bool _append = false, bool _flushes = true);
493493
virtual ~FileLogMsgHandler();
494-
unsigned queryMessageFields() const override { return messageFields; }
495-
void setMessageFields(unsigned _fields) override { messageFields = _fields; }
496-
int flush() override { CriticalBlock block(crit); return fflush(handle); }
497-
bool getLogName(StringBuffer &name) const override { name.append(filename); return true; }
498-
offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); fflush(handle); name.append(filename); return ftell(handle); }
494+
virtual unsigned queryMessageFields() const override { return messageFields; }
495+
virtual void setMessageFields(unsigned _fields) override { messageFields = _fields; }
496+
virtual int flush() override { CriticalBlock block(crit); return fflush(handle); }
497+
virtual bool getLogName(StringBuffer &name) const override { name.append(filename); return true; }
498+
virtual offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); fflush(handle); name.append(filename); return ftell(handle); }
499499

500500
protected:
501501
FILE * handle;
@@ -513,35 +513,35 @@ class FileLogMsgHandlerJSON : implements FileLogMsgHandler, public CInterface
513513
public:
514514
FileLogMsgHandlerJSON(const char * _filename, const char * _headerText = 0, unsigned _fields = MSGFIELD_all, bool _append = false, bool _flushes = true) : FileLogMsgHandler(_filename, _headerText, _fields, _append, _flushes) {}
515515
IMPLEMENT_IINTERFACE;
516-
void handleMessage(const LogMsg & msg) override;
517-
bool needsPrep() const override { return false; }
518-
void prep() override {}
519-
void addToPTree(IPropertyTree * tree) const override;
520-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_json; };
516+
virtual void handleMessage(const LogMsg & msg) override;
517+
virtual bool needsPrep() const override { return false; }
518+
virtual void prep() override {}
519+
virtual void addToPTree(IPropertyTree * tree) const override;
520+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_json; };
521521
};
522522

523523
class FileLogMsgHandlerXML : implements FileLogMsgHandler, public CInterface
524524
{
525525
public:
526526
FileLogMsgHandlerXML(const char * _filename, const char * _headerText = 0, unsigned _fields = MSGFIELD_all, bool _append = false, bool _flushes = true) : FileLogMsgHandler(_filename, _headerText, _fields, _append, _flushes) {}
527527
IMPLEMENT_IINTERFACE;
528-
void handleMessage(const LogMsg & msg) override;
529-
bool needsPrep() const override { return false; }
530-
void prep() override {}
531-
void addToPTree(IPropertyTree * tree) const override;
532-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_xml; };
528+
virtual void handleMessage(const LogMsg & msg) override;
529+
virtual bool needsPrep() const override { return false; }
530+
virtual void prep() override {}
531+
virtual void addToPTree(IPropertyTree * tree) const override;
532+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_xml; };
533533
};
534534

535535
class FileLogMsgHandlerTable : implements FileLogMsgHandler, public CInterface
536536
{
537537
public:
538538
FileLogMsgHandlerTable(const char * _filename, const char * _headerText = 0, unsigned _fields = MSGFIELD_all, bool _append = false, bool _flushes = true) : FileLogMsgHandler(_filename, _headerText, _fields, _append, _flushes), prepped(false) {}
539539
IMPLEMENT_IINTERFACE;
540-
void handleMessage(const LogMsg & msg) override;
541-
bool needsPrep() const override { return !prepped; }
542-
void prep() override { CriticalBlock block(crit); LogMsg::fprintTableHead(handle, messageFields); prepped = true; }
543-
void addToPTree(IPropertyTree * tree) const override;
544-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_table; };
540+
virtual void handleMessage(const LogMsg & msg) override;
541+
virtual bool needsPrep() const override { return !prepped; }
542+
virtual void prep() override { CriticalBlock block(crit); LogMsg::fprintTableHead(handle, messageFields); prepped = true; }
543+
virtual void addToPTree(IPropertyTree * tree) const override;
544+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_table; };
545545
private:
546546
bool prepped;
547547
};
@@ -562,7 +562,7 @@ public:
562562
virtual int flush() override { CriticalBlock block(crit); return fflush(handle); }
563563
virtual bool getLogName(StringBuffer &name) const override { CriticalBlock block(crit); name.append(filename); return true; }
564564
virtual offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); fflush(handle); name.append(filename); return ftell(handle); }
565-
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
565+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_table; };
566566
protected:
567567
void checkRollover();
568568
void doRollover();
@@ -587,7 +587,7 @@ public:
587587
const char *initialName = NULL, const char *alias = NULL, bool daily = false, long _maxLogFileSize = 0);
588588
virtual ~RollingFileLogMsgHandler();
589589
IMPLEMENT_IINTERFACE;
590-
void handleMessage(const LogMsg & msg) override
590+
virtual void handleMessage(const LogMsg & msg) override
591591
{
592592
CriticalBlock block(crit);
593593
checkRollover();
@@ -604,15 +604,15 @@ public:
604604

605605
if(flushes) fflush(handle);
606606
}
607-
bool needsPrep() const override { return false; }
608-
void prep() override {}
609-
unsigned queryMessageFields() const override { return messageFields; }
610-
void setMessageFields(unsigned _fields) override { messageFields = _fields; }
611-
void addToPTree(IPropertyTree * tree) const override;
612-
int flush() override { CriticalBlock block(crit); return fflush(handle); }
613-
bool getLogName(StringBuffer &name) const override { CriticalBlock block(crit); name.append(filename); return true; }
614-
offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); fflush(handle); name.append(filename); return ftell(handle); }
615-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
607+
virtual bool needsPrep() const override { return false; }
608+
virtual void prep() override {}
609+
virtual unsigned queryMessageFields() const override { return messageFields; }
610+
virtual void setMessageFields(unsigned _fields) override { messageFields = _fields; }
611+
virtual void addToPTree(IPropertyTree * tree) const override;
612+
virtual int flush() override { CriticalBlock block(crit); return fflush(handle); }
613+
virtual bool getLogName(StringBuffer &name) const override { CriticalBlock block(crit); name.append(filename); return true; }
614+
virtual offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); fflush(handle); name.append(filename); return ftell(handle); }
615+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
616616

617617
protected:
618618
void checkRollover();
@@ -644,16 +644,16 @@ public:
644644
BinLogMsgHandler(const char * _filename, bool _append = false);
645645
virtual ~BinLogMsgHandler();
646646
IMPLEMENT_IINTERFACE;
647-
void handleMessage(const LogMsg & msg) override;
648-
bool needsPrep() const override { return false; }
649-
void prep() override {}
650-
void addToPTree(IPropertyTree * tree) const override;
651-
unsigned queryMessageFields() const override { return MSGFIELD_all; }
652-
void setMessageFields(unsigned _fields) override {}
653-
int flush() override { return 0; }
654-
bool getLogName(StringBuffer &name) const override { name.append(filename); return true; }
655-
offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); name.append(filename); return fstr->tell(); }
656-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
647+
virtual void handleMessage(const LogMsg & msg) override;
648+
virtual bool needsPrep() const override { return false; }
649+
virtual void prep() override {}
650+
virtual void addToPTree(IPropertyTree * tree) const override;
651+
virtual unsigned queryMessageFields() const override { return MSGFIELD_all; }
652+
virtual void setMessageFields(unsigned _fields) override {}
653+
virtual int flush() override { return 0; }
654+
virtual bool getLogName(StringBuffer &name) const override { name.append(filename); return true; }
655+
virtual offset_t getLogPosition(StringBuffer &name) const override { CriticalBlock block(crit); name.append(filename); return fstr->tell(); }
656+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
657657
protected:
658658
StringAttr filename;
659659
bool append;
@@ -671,16 +671,16 @@ class SysLogMsgHandler : implements ILogMsgHandler, public CInterface
671671
public:
672672
SysLogMsgHandler(ISysLogEventLogger * _logger, unsigned _fields) : logger(_logger), fields(_fields) {}
673673
IMPLEMENT_IINTERFACE;
674-
void handleMessage(const LogMsg & msg) override;
675-
bool needsPrep() const override { return false; }
676-
void prep() override {}
677-
void addToPTree(IPropertyTree * tree) const override;
678-
unsigned queryMessageFields() const override { return fields; }
679-
void setMessageFields(unsigned _fields) override { fields = _fields; }
680-
int flush() override { return 0; }
681-
bool getLogName(StringBuffer &name) const override { return false; }
682-
offset_t getLogPosition(StringBuffer &logFileName) const override { return 0; }
683-
LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
674+
virtual void handleMessage(const LogMsg & msg) override;
675+
virtual bool needsPrep() const override { return false; }
676+
virtual void prep() override {}
677+
virtual void addToPTree(IPropertyTree * tree) const override;
678+
virtual unsigned queryMessageFields() const override { return fields; }
679+
virtual void setMessageFields(unsigned _fields) override { fields = _fields; }
680+
virtual int flush() override { return 0; }
681+
virtual bool getLogName(StringBuffer &name) const override { return false; }
682+
virtual offset_t getLogPosition(StringBuffer &logFileName) const override { return 0; }
683+
virtual LogHandlerFormat queryFormatType() const override { return LOGFORMAT_undefined; };
684684
protected:
685685
ISysLogEventLogger * logger;
686686
unsigned fields;

0 commit comments

Comments
 (0)