Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit dde504d

Browse files
Merge logging fixes to master (#103)
* Fix logging to properly attach exception info in Stats.ImportAzureCdnStatistics catch-all blocks (#102) * Fix logging message
1 parent 68d9b5a commit dde504d

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/Stats.AzureCdnLogs.Common/LogEvents.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ public class LogEvents
2121
public static EventId InvalidRawLogFileName = new EventId(511, "Invalid raw log filename");
2222
public static EventId FailedToGetFtpResponse = new EventId(512, "Failed to get FTP response");
2323
public static EventId JobRunFailed = new EventId(550, "Job run failed");
24+
public static EventId JobInitFailed = new EventId(551, "Job initialization failed");
2425
}
2526
}

src/Stats.ImportAzureCdnStatistics/Job.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override bool Init(IDictionary<string, string> jobArgsDictionary)
6464
}
6565
catch (Exception exception)
6666
{
67-
_logger.LogCritical("Failed to initialize job! {Exception}", exception);
67+
_logger.LogCritical(LogEvents.JobInitFailed, exception, "Failed to initialize job!");
6868

6969
return false;
7070
}
@@ -117,7 +117,7 @@ public override async Task<bool> Run()
117117
}
118118
catch (Exception exception)
119119
{
120-
_logger.LogCritical("Job run failed! {Exception}", exception);
120+
_logger.LogCritical(LogEvents.JobRunFailed, exception, "Job run failed!");
121121

122122
return false;
123123
}

src/Stats.ImportAzureCdnStatistics/LogFileProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private async Task DeleteSourceBlobAsync(ILeasedLogFile logFile)
383383
}
384384
catch (Exception exception)
385385
{
386-
_logger.LogError(LogEvents.FailedBlobDelete, exception, "Finished to delete blob {FtpBlobUri}", logFile.Uri);
386+
_logger.LogError(LogEvents.FailedBlobDelete, exception, "Failed to delete blob {FtpBlobUri}", logFile.Uri);
387387
ApplicationInsightsHelper.TrackException(exception, logFile.Blob.Name);
388388
throw;
389389
}

0 commit comments

Comments
 (0)