From c2ed7e6e67d4ff25ef2bf0f0bcb931c4d35947cc Mon Sep 17 00:00:00 2001 From: Polina Tyureva Date: Thu, 19 Nov 2026 22:30:18 +0400 Subject: [PATCH 1/3] update logging --- .../appsettings.json | 1 + .../Reporting/ReportingLoggerService.cs | 20 ----------- AspNetCore.Reporting.MVC/appsettings.json | 1 + Readme.md | 36 ++++++------------- 4 files changed, 12 insertions(+), 46 deletions(-) delete mode 100644 AspNetCore.Reporting.Common/Services/Reporting/ReportingLoggerService.cs diff --git a/AspNetCore.Reporting.Angular/AspNetCore.Reporting.Angular.Server/appsettings.json b/AspNetCore.Reporting.Angular/AspNetCore.Reporting.Angular.Server/appsettings.json index 30860e1..9793e74 100644 --- a/AspNetCore.Reporting.Angular/AspNetCore.Reporting.Angular.Server/appsettings.json +++ b/AspNetCore.Reporting.Angular/AspNetCore.Reporting.Angular.Server/appsettings.json @@ -6,6 +6,7 @@ "Logging": { "LogLevel": { "Default": "Warning", + "DevExpress": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } diff --git a/AspNetCore.Reporting.Common/Services/Reporting/ReportingLoggerService.cs b/AspNetCore.Reporting.Common/Services/Reporting/ReportingLoggerService.cs deleted file mode 100644 index 02fd060..0000000 --- a/AspNetCore.Reporting.Common/Services/Reporting/ReportingLoggerService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using DevExpress.XtraReports.Web.ClientControls; -using Microsoft.Extensions.Logging; - -namespace AspNetCore.Reporting.Common.Services.Reporting { - public class ReportingLoggerService: LoggerService { - readonly ILogger logger; - public ReportingLoggerService(ILogger logger) { - this.logger = logger; - } - public override void Error(Exception exception, string message) { - var logMessage = $"[{DateTime.Now}]: Exception occurred. Message: '{message}'. Exception Details:{Environment.NewLine}{exception}"; - logger.LogError(logMessage); - } - - public override void Info(string message) { - logger.LogInformation(message); - } - } -} diff --git a/AspNetCore.Reporting.MVC/appsettings.json b/AspNetCore.Reporting.MVC/appsettings.json index a611470..1cf7a75 100644 --- a/AspNetCore.Reporting.MVC/appsettings.json +++ b/AspNetCore.Reporting.MVC/appsettings.json @@ -8,6 +8,7 @@ "Logging": { "LogLevel": { "Default": "Information", + "DevExpress": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } diff --git a/Readme.md b/Readme.md index 2d322e4..405a0b4 100644 --- a/Readme.md +++ b/Readme.md @@ -427,37 +427,21 @@ This document section describes the best practices that you should follow when y ### Log Errors that Occurred in the Code of DevExpress Reporting Components -To handle exceptions generated by DevExpress reporting components, implement and register a logger service and override the `Error` method in your service implementation. In the `Error` method's implementation, save errors to a log or database. If a Visual Studio debugger is attached, you can set a breakpoint and inspect errors in the Watch window. +DevExpress reporting components write log messages through the standard [Microsoft.Extensions.Logging](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/) API. Messages go to the logging providers registered in the application, so no custom logger class is required. To save errors to a file or database, register a logging provider that writes to that storage. -##### Implement a Logger Class +Use the `DevExpress` log category to configure which messages are logged. The following *appsettings.json* configuration logs DevExpress messages with the `Information` level and higher: -[ReportingLoggerService.cs](AspNetCore.Reporting.Common/Services/Reporting/ReportingLoggerService.cs): - -```csharp -public class ReportingLoggerService: LoggerService { - readonly ILogger logger; - public ReportingLoggerService(ILogger logger) { - this.logger = logger; - } - public override void Error(Exception exception, string message) { - var logMessage = $"[{DateTime.Now}]: Exception occurred. Message: '{message}'. Exception Details:{Environment.NewLine}{exception}"; - logger.LogError(logMessage); - } - - public override void Info(string message) { - logger.LogInformation(message); - } +```json +"Logging": { + "LogLevel": { + "Default": "Information", + "DevExpress": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } } ``` -##### Register the Logger - -Call `LoggerService.Initialize` at application startup and pass the logger factory obtained from the DI container: - -```cs -LoggerService.Initialize(new ReportingLoggerService(loggerFactory.CreateLogger("DXReporting"))); -``` - ### Use Custom Exception Handlers Use custom exception handler services to customize error details that are passed to the client and displayed in the client UI: From 84880709890f9798fc4f07e535c8cae60abde5f9 Mon Sep 17 00:00:00 2001 From: Polina T <56310766+pollyndos@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:14:52 +0400 Subject: [PATCH 2/3] Apply batched suggestions from code review Co-authored-by: Polina T <56310766+pollyndos@users.noreply.github.com> --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 405a0b4..7f37efc 100644 --- a/Readme.md +++ b/Readme.md @@ -427,9 +427,9 @@ This document section describes the best practices that you should follow when y ### Log Errors that Occurred in the Code of DevExpress Reporting Components -DevExpress reporting components write log messages through the standard [Microsoft.Extensions.Logging](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/) API. Messages go to the logging providers registered in the application, so no custom logger class is required. To save errors to a file or database, register a logging provider that writes to that storage. +DevExpress reporting components write log messages through the standard [Microsoft.Extensions.Logging](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/) API. Messages go to the logging providers registered in the application. To save errors to a file or database, register a logging provider that writes to that storage. -Use the `DevExpress` log category to configure which messages are logged. The following *appsettings.json* configuration logs DevExpress messages with the `Information` level and higher: +Use the **DevExpress** log category to configure which messages are logged. The following *appsettings.json* configuration logs DevExpress messages with the **Information** level and higher: ```json "Logging": { From bcba510f119e11980ba889f88a50b98f7a585004 Mon Sep 17 00:00:00 2001 From: Polina T <56310766+pollyndos@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:56:31 +0400 Subject: [PATCH 3/3] update readme Co-authored-by: dirkpieterse --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 7f37efc..baa90b4 100644 --- a/Readme.md +++ b/Readme.md @@ -120,7 +120,7 @@ To optimize memory consumption, use the following techniques: } ``` -- Configure Storage and Cache cleaners on application startup. This allows you to specify how long you want to reserve resources to store document data on the server. Note that after a document's data is removed for the Storage and Cache, you cannot navigate or print this document. +- Configure Storage and Cache cleaners at application startup. This lets you specify how long document data is stored on the server. Once a document's data is removed from Storage and Cache, you cannot navigate or print the document. [ServiceRegistrator.cs](AspNetCore.Reporting.Common/Services/ServiceRegistrator.cs#L17-L21) @@ -429,7 +429,7 @@ This document section describes the best practices that you should follow when y DevExpress reporting components write log messages through the standard [Microsoft.Extensions.Logging](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/) API. Messages go to the logging providers registered in the application. To save errors to a file or database, register a logging provider that writes to that storage. -Use the **DevExpress** log category to configure which messages are logged. The following *appsettings.json* configuration logs DevExpress messages with the **Information** level and higher: +Use the **DevExpress** log category to configure which messages are logged. The following *appsettings.json* configuration logs DevExpress messages at the **Information** level and higher: ```json "Logging": {