BancoEventErrorLog 1.0.0
dotnet add package BancoEventErrorLog --version 1.0.0
NuGet\Install-Package BancoEventErrorLog -Version 1.0.0
<PackageReference Include="BancoEventErrorLog" Version="1.0.0" />
paket add BancoEventErrorLog --version 1.0.0
#r "nuget: BancoEventErrorLog, 1.0.0"
// Install BancoEventErrorLog as a Cake Addin #addin nuget:?package=BancoEventErrorLog&version=1.0.0 // Install BancoEventErrorLog as a Cake Tool #tool nuget:?package=BancoEventErrorLog&version=1.0.0
Created a new nuGetPackage for Event Log for logging events to Event Viewer and error Log/send email on exception dll.
1) Creates and saves event Log.
2) Sends email on errors.
Sample event log:
Event log can be written to Windows Event viewer or can also be saved to a text file [managed through settings in config file]
ErrorLogHelper.WriteErrorLog("Window service Init");
Sample Error Log during exception:
ErrorLogHelper.LogErrorandSendMail("Sample error, also pass the exception that occured", ex)
This above exception can be written to an event log and also send an email by implementing below
ErrorLogHelper.WriteErrorLog(ErrorLogHelper.LogErrorandSendMail("Window service failed to Initialize", ex), System.Diagnostics.EventLogEntryType.Error);
Following are the config settings that need to be set that are specific for the app:
Default implementation is to write it to a text file, but it can write to an event log and send an email by changing the following
ConfigurationManager.AppSettings["LogEvent"]
ConfigurationManager.AppSettings["SendErrorEmail"]
Event Viewer Name
= ConfigurationManager.AppSettings["EventViewerName"]
text file file path
ConfigurationManager.AppSettings["LogFilePath"]
Email From and Display Name
ConfigurationManager.AppSettings["EmailDisplayName"].ToString(), ConfigurationManager.AppSettings["EmailAddressFrom"]
Email Subject:
ConfigurationManager.AppSettings["EmailSubject"]
Email To:
ConfigurationManager.AppSettings["EmailAddress"]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,103 | 12/28/2015 |