@@ -154,6 +154,28 @@ Therefore these options are set by default `KeepFileOpen = true` and `ArchiveOld
154154The GZip File compression has better handling of large log-files compared to the old ` EnableArchiveFileCompression = true ` ,
155155where the old ZIP compression would stall the file-logging until completed.
156156
157+ ### NLog DatabaseTarget supports AOT
158+
159+ NLog DatabaseTarget uses by default type-reflection for resolving DbConnection-factory from the ` DbProvider ` -option.
160+
161+ NLog DatabaseTarget now have a new constructor, where one can specify method-delegate when configuring from code:
162+ ``` csharp
163+ var databaseTarget = new NLog .Targets .DatabaseTarget (() => new Npgsql .NpgsqlConnection ());
164+ NLog .LogManager .Setup ().LoadConfiguration (cfg => cfg .ForLogger ().WriteTo (databaseTarget ));
165+ ```
166+
167+ When specifying DbType for database-call-parameters, then NLog DatabaseTarget uses type-reflection to parse and
168+ assign the DbType. NLog ` DatabaseParameterInfo ` now have a new constructor, where one can specify method-delegate:
169+ ``` csharp
170+ var databaseParameter = new DatabaseParameterInfo (" @context" ,
171+ " ${all-event-properties}" ,
172+ (p ) => ((NpgsqlParameter )p ).NpgsqlDbType = NpgsqlDbType .VarChar );
173+ databaseTarget .Parameters .Add (databaseParameter );
174+ ```
175+
176+ When using these new constructors from the [ NLog.Database] ( https://www.nuget.org/packages/NLog.Database ) -nuget-package,
177+ then it will not trigger AOT-build-warnings.
178+
157179### NLog LogFactory FlushAsync
158180
159181NLog LogFactory ` Flush() ` and ` Shutdown() ` are synchronous API methods, that schedules background worker-threads
@@ -362,11 +384,11 @@ The Console for an application is usually a singleton, and there is an overhead
362384The normal work-around is to send output to a queue, and let a background thread do the actual Console writing.
363385But if the application threads are running at full speed, then they can easily produce more output than the background thread can handle.
364386
365- NLog has the ability to batch multiple LogEvents into a single write-operation, when combining the NLog ConsoleTarget with
387+ The NLog ConsoleTarget supports batch writing of multiple LogEvents in a single write-operation, when combined with
366388AsyncWrapperTarget (Ex. ` <targets async="true"> ` ). When enabled then it would double the performance of the Console-output.
367389This ability was introduced with NLog v4.6.8 and protected with the feature-flag ` WriteBuffer ` .
368390
369- NLog v6 enables this feature and will not use Console.WriteLine by default.
391+ NLog v6 enables batch-writing and will not use ` Console.WriteLine ` by default.
370392The feature-flag has also changed name to ` ForceWriteLine ` (Default = false).
371393If depending on console redirection where output must reach ` Console.WriteLine ` ,
372394then one can explicit assign ` ForceWriteLine = true ` for the NLog ConsoleTarget.
@@ -417,7 +439,7 @@ If RegEx replace-logic is important then one can use the new nuget-package `NLog
417439
418440### NLog InternalLogger without LogToTrace
419441
420- NLog ` InternalLogger.LogToTrace ` has been remnoved . This reduces the NLog footprint by
442+ NLog ` InternalLogger.LogToTrace ` has been removed . This reduces the NLog footprint by
421443removing references to ` System.Diagnostics.Trace ` and ` System.Diagnostics.TraceListener ` .
422444
423445If it is important to redirect NLog InternalLogger output to ` System.Diagnostics.Trace ` ,
0 commit comments