Simplify.Log 2.2.1

dotnet add package Simplify.Log --version 2.2.1
NuGet\Install-Package Simplify.Log -Version 2.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Simplify.Log" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplify.Log --version 2.2.1
#r "nuget: Simplify.Log, 2.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Simplify.Log as a Cake Addin
#addin nuget:?package=Simplify.Log&version=2.2.1

// Install Simplify.Log as a Cake Tool
#tool nuget:?package=Simplify.Log&version=2.2.1

Simplify.Log Documentation

Provides ILogger interface and Logger class for file-based log.

With Logger you can write messages to a text log, including just some strings or exception data with full stack trace, line numbers and inner exceptions stack traces.

Available at NuGet as binary package

Simple string log message example:

[01.03.2014 18:24:11:330] Main : Hello world!!!

Exception log message example:

[26.02.2014 13:39:00:023] NHibernate.Exceptions.GenericADOException : could not execute query
[ select flightexcl0_.ID as ID5462_, flightexcl0_.FlightNumber as FlightNu2_5462_ from FlightsExcludeList flightexcl0_ ]
[SQL: select flightexcl0_.ID as ID5462_, flightexcl0_.FlightNumber as FlightNu2_5462_ from FlightsExcludeList flightexcl0_]
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
   at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
   at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
   at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
   at NHibernate.Impl.ExpressionQueryImpl.List()
   at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
   at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
   at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
   at Remotion.Linq.QueryableBase`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at FluentNHibernate.Extender.DbConnection.GetList[T](Expression`1 filterFunc)
   at Processing.Processing.Processor..ctor(IDbConnection dbConnection, IList`1 officesForProcessing) in c:\CCNet\WorkingDirectory\Processing\src\Processing\Processing\Processor.cs:line 81
   at Processing.Service.OnWork(Object state) in c:\CCNet\WorkingDirectory\SsrProcessing\src\SsrProcessing\Service.cs:line 52
[Inner Exception] Oracle.ManagedDataAccess.Client.OracleException : Connection request timed out
   at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, String instanceName)
   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
   at NHibernate.AdoNet.ConnectionManager.GetConnection()
   at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)

General usage

Logger.Default ambient context provides default logger.

  • By default, if no Logger configuration exist in config file, data will be written to Logs.log file in current directory (calling assembly location), or web-site root for APS.NET web-sites and WCF services, If a log file size will exceed a limit of 5 mb, then it will be cleaned.

Writing a simple string to a log:

Logger.Default.Write("Hello world!!!");

Writing an exception to a log:

try
{
	...
}
catch (Exception e)
{
	Logger.Default.Write(e);
}

App.config configuration example:

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
	<configSections>
		<section name="Logger" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
	</configSections>
	
	
	<Logger>
		<add key="FileName" value="MyLog.log"/>
	</Logger>
</configuration>

Custom usage

Custom initialization

Logger can be instantiated with specified settings section in config file. Fo example, from MyLoggerSettings section in config file:

var logger = new Logger("MyLoggerSettings");
<?xml version="1.0" encoding="UTF-8"?>

<configuration>
	<configSections>
		<section name="MyLoggerSettings" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
	</configSections>
	
	
	<MyLoggerSettings>
		<add key="FileName" value="MyLog.log"/>
	</MyLoggerSettings>
</configuration>
Custom configuration
	<Logger>
		
		<add key="FileName" value="C:\Logs\MyApp.log"/>
		<add key="PathType" value="FullPath"/>

		
		<add key="MaxFileSize" value="5000"/>

		
		<add key="ShowTraceOutput" value="true"/>
	</Logger>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.2.1 169 8/26/2023
2.1.0 341 11/30/2022
2.0.3 480 5/2/2022
2.0.2 333 1/3/2022
2.0.1 331 12/18/2021
2.0.0 356 10/26/2021
1.6.2 492 2/2/2021
1.6.1 493 12/10/2020
1.6.0 558 7/7/2020
1.4.3 658 9/28/2019
1.4.2 645 6/23/2019
1.4.1 693 4/16/2019
1.4.0 775 1/4/2019
1.3.1 922 10/1/2018
1.3.0 1,042 6/19/2018
1.2.0 1,078 4/15/2018
1.1.1 1,057 8/24/2017
1.1.0 1,157 8/18/2016
1.0.5 1,332 6/26/2015
1.0.4 1,698 10/23/2014
1.0.3 1,205 9/22/2014
1.0.2 1,456 5/21/2014
1.0.1 1,189 4/23/2014
1.0.0 1,207 2/25/2014