Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit ad04e8a

Browse files
committed
Add debug logs for scheduling flush for urgent events
There are several reports that urgent events such are doorbell events failed to make to cloud. It's possible that urgent events failed to schedule flush and later get dropped silently due to event buffer overflow. Add more logs to indicate the status of scheudling flush for urgent events to see if there's any correaltion that need to be wary about. In addition, NCCM people reported that they only called nl::Logevent once but multiple events are logged at the same timestamp. Currently WeaveLogDetail is disabled on user build and we don't have any logs regarding the event logging on weave side. Increasing the log level of 'logevent' to WeaveLogProgess. This should be ok as it's still guarded by WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS. This change will 1) Add debug logs for scheduling flush for urgent events. 2) Print error message if scheduling flush failed with error (currently this error doesn't get printed or surfaced up). 3) Increase level of 'logevent' to WeaveLogProgess, guarded by WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS
1 parent 2468803 commit ad04e8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib/profiles/data-management/Current/LoggingManagement.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ inline event_id_t LoggingManagement::LogEventPrivate(const EventSchema & inSchem
12391239
GetImportanceBuffer(inSchema.mImportance)->AddEventUTC(opts.timestamp.utcTimestamp);
12401240

12411241
#if WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS
1242-
WeaveLogDetail(
1242+
WeaveLogProgress(
12431243
EventLogging, "LogEvent event id: %u importance: %u profile id: 0x%x structure id: 0x%x utc timestamp: 0x%" PRIx64,
12441244
event_id, inSchema.mImportance, inSchema.mProfileId, inSchema.mStructureType, opts.timestamp.utcTimestamp);
12451245
#endif // WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS
@@ -1250,7 +1250,7 @@ inline event_id_t LoggingManagement::LogEventPrivate(const EventSchema & inSchem
12501250
GetImportanceBuffer(inSchema.mImportance)->AddEvent(opts.timestamp.systemTimestamp);
12511251

12521252
#if WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS
1253-
WeaveLogDetail(
1253+
WeaveLogProgress(
12541254
EventLogging, "LogEvent event id: %u importance: %u profile id: 0x%x structure id: 0x%x sys timestamp: 0x%" PRIx32,
12551255
event_id, inSchema.mImportance, inSchema.mProfileId, inSchema.mStructureType, opts.timestamp.systemTimestamp);
12561256
#endif // WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS
@@ -1840,13 +1840,19 @@ WEAVE_ERROR LoggingManagement::ScheduleFlushIfNeeded(bool inRequestFlush)
18401840
if ((mExchangeMgr != NULL) && (mExchangeMgr->MessageLayer != NULL) && (mExchangeMgr->MessageLayer->SystemLayer != NULL))
18411841
{
18421842
mExchangeMgr->MessageLayer->SystemLayer->ScheduleWork(LoggingFlushHandler, this);
1843+
WeaveLogProgress(EventLogging, "Scheduled flush for urgent event.");
18431844
}
18441845
else
18451846
{
18461847
err = WEAVE_ERROR_INCORRECT_STATE;
18471848
mUploadRequested = false;
1849+
WeaveLogError(EventLogging, "Schedule flush failed with error: %s", ErrorStr(err));
18481850
}
18491851
}
1852+
else if (inRequestFlush)
1853+
{
1854+
WeaveLogProgress(EventLogging, "Flush already scheduled, no need to schedule an additional flush.");
1855+
}
18501856

18511857
return err;
18521858
}

0 commit comments

Comments
 (0)