Jeff.Jones.JLogger 1.1.2

A singleton logging component.  Simple to use, lots of flexibility.  Writes to a user-specified log and path, and optionally sends email.  Can also write logs to a SQL Server database, with optional audit log. T-SQL files included. For .NET Core 2.0+, .NET Standard 2.0+, .NET Framework 4.6.1+

Install-Package Jeff.Jones.JLogger -Version 1.1.2
dotnet add package Jeff.Jones.JLogger --version 1.1.2
<PackageReference Include="Jeff.Jones.JLogger" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jeff.Jones.JLogger --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Overview

JLogger is a singleton component as a .NET Standard 2.0 library component that
can be used with Core 2.0+, Standard, Framework 4.6.1+, Mono, and
Xamarin.

JLogger has these characteristics:

  • Write to a file, or write to a database table (SQL Server scripts to create
    the table and stored procedures are included). Also supports the use of a
    DBLogAudit table for audit logging any changes to the DBLog table.

  • Multithreaded use – As a singleton, it is accessible from any thread, and
    uses locking techniques to ensure there are no collisions.

  • High throughput – If the log is being used by many threads concurrently, the
    log writes do not stop the calling thread. JLogger uses a first-in,
    first-out (FIFO) queue where log writes are put in a queue and written to a
    file in a separate thread, concurrently in the background. The WriteDebugLog
    command takes the parameters, creates the log data, puts it in a queue. None
    of those steps are blocking.

  • User defined log fields – The log setup (done in code, see example below)
    can specify additional columns that are defined by the user. Once setup,
    each write to the debug log, in code, can write to any, all, or none,
    of those fields with values. If no user-defined field values are provided
    on a log write, then empty values are added to the column for that row in
    the log.

  • Send an Email – A debug log write can optionally send an email (SMTP
    configuration data required)

  • Multiple Log Entry Types – there are several log entry types to choose from.
    What they each mean is up to the user writing the code. Some log types are
    reserved for the component, and would be ignored in processing the log
    entry. These are detailed below.

  • New Log File each Day – after midnight, a new log file is created so log
    files are named to show the date and time span the log was active.

  • Log Retention – logs (and log entries in a database table) are automatically
    removed after the specified number of days, unless zero is specified, in
    which case no log files (or log entries in a database table) are deleted.

  • Tab-delimited Log File – the log is written as a tab-delimited file. This
    enables opening up the file in programs like Excel for analysis.

  • Logs can specify the device issuing the log write, and an entity name that
    can be used to specify an organization, function, customer, etc.

  • This file and the DB folder with the SQL Server scripts are located where
    the NuGet package is installed.

LOG_TYPES Enum

The enum contains values for the types of logs, and for how the logs are created
and managed.

JLogger does not use different method names for types of log entries. Instead,
the LOG_TYPES enum is used to create a bitmask that is passed in as a parameter when
writing to the log. This allows the programmer to only call the log method when
the bitmask fits. This eliminates the overhead of log method calls. It also allows
a configuration for whatever the desired set of features and log levels are
wanted, which can be changed during runtime.

Code examples can be found in the demo project at:
https://github.com/MSBassSinger/JLogger_Demo

Overview

JLogger is a singleton component as a .NET Standard 2.0 library component that
can be used with Core 2.0+, Standard, Framework 4.6.1+, Mono, and
Xamarin.

JLogger has these characteristics:

  • Write to a file, or write to a database table (SQL Server scripts to create
    the table and stored procedures are included). Also supports the use of a
    DBLogAudit table for audit logging any changes to the DBLog table.

  • Multithreaded use – As a singleton, it is accessible from any thread, and
    uses locking techniques to ensure there are no collisions.

  • High throughput – If the log is being used by many threads concurrently, the
    log writes do not stop the calling thread. JLogger uses a first-in,
    first-out (FIFO) queue where log writes are put in a queue and written to a
    file in a separate thread, concurrently in the background. The WriteDebugLog
    command takes the parameters, creates the log data, puts it in a queue. None
    of those steps are blocking.

  • User defined log fields – The log setup (done in code, see example below)
    can specify additional columns that are defined by the user. Once setup,
    each write to the debug log, in code, can write to any, all, or none,
    of those fields with values. If no user-defined field values are provided
    on a log write, then empty values are added to the column for that row in
    the log.

  • Send an Email – A debug log write can optionally send an email (SMTP
    configuration data required)

  • Multiple Log Entry Types – there are several log entry types to choose from.
    What they each mean is up to the user writing the code. Some log types are
    reserved for the component, and would be ignored in processing the log
    entry. These are detailed below.

  • New Log File each Day – after midnight, a new log file is created so log
    files are named to show the date and time span the log was active.

  • Log Retention – logs (and log entries in a database table) are automatically
    removed after the specified number of days, unless zero is specified, in
    which case no log files (or log entries in a database table) are deleted.

  • Tab-delimited Log File – the log is written as a tab-delimited file. This
    enables opening up the file in programs like Excel for analysis.

  • Logs can specify the device issuing the log write, and an entity name that
    can be used to specify an organization, function, customer, etc.

  • This file and the DB folder with the SQL Server scripts are located where
    the NuGet package is installed.

LOG_TYPES Enum

The enum contains values for the types of logs, and for how the logs are created
and managed.

JLogger does not use different method names for types of log entries. Instead,
the LOG_TYPES enum is used to create a bitmask that is passed in as a parameter when
writing to the log. This allows the programmer to only call the log method when
the bitmask fits. This eliminates the overhead of log method calls. It also allows
a configuration for whatever the desired set of features and log levels are
wanted, which can be changed during runtime.

Code examples can be found in the demo project at:
https://github.com/MSBassSinger/JLogger_Demo

Release Notes

For .NET Core 2.0+, .NET Standard 2.0+, .NET Framework 4.6.1+
All requests for support must be sent by email to:
MSBassSinger@comcast.net
The email MUST havd "JLogger" in the Subject line
You MUST provide details that include code snippets of where the failure occured, and exact failure or exception messages.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.2 33 7/20/2020
1.1.1 123 10/22/2019
1.1.0 127 10/18/2019
1.0.1 181 7/23/2019
1.0.0 173 7/15/2019