Server settings in log4net.config: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
(Created page with "QPR ProcessAnalyzer uses the log4net component (https://logging.apache.org/log4net/) for logging, allowing to flexibly define what is logged and where the logs are stored. For example, the following settings can be set in the '''log4net.config''' file (located in the '''bin''' folder in the server application files): * log4net > appender > '''maximumFileSize''': Maximum size of the log file. When the maximum size is reached, the log writing continues in a new file, and t...")
 
No edit summary
Line 1: Line 1:
QPR ProcessAnalyzer uses the log4net component (https://logging.apache.org/log4net/) for logging, allowing to flexibly define what is logged and where the logs are stored. For example, the following settings can be set in the '''log4net.config''' file (located in the '''bin''' folder in the server application files):
QPR ProcessAnalyzer uses the log4net component (https://logging.apache.org/log4net/) for logging, allowing to flexibly define what is logged and where the logs are stored.
 
==Write logs to file==
 
For example, the following settings can be set in the '''log4net.config''' file (located in the '''bin''' folder in the server application files):
* log4net > appender > '''maximumFileSize''': Maximum size of the log file. When the maximum size is reached, the log writing continues in a new file, and the old file is archived. The default setting is 100MB. (https://logging.apache.org/log4net/log4net-1.2.13/release/sdk/log4net.Appender.RollingFileAppender.MaximumFileSize.html)
* log4net > appender > '''maximumFileSize''': Maximum size of the log file. When the maximum size is reached, the log writing continues in a new file, and the old file is archived. The default setting is 100MB. (https://logging.apache.org/log4net/log4net-1.2.13/release/sdk/log4net.Appender.RollingFileAppender.MaximumFileSize.html)
* log4net > appender > '''maxSizeRollBackups''': Maximum number of archived log files that are stored. When the maximum file size is reached and new file is created, the oldest archived log file is removed if the maximum number of archived files is reached. The default setting is 1. (http://logging.apache.org/log4net/log4net-1.2.15/release/sdk/html/P_log4net_Appender_RollingFileAppender_MaxSizeRollBackups.htm)
* log4net > appender > '''maxSizeRollBackups''': Maximum number of archived log files that are stored. When the maximum file size is reached and new file is created, the oldest archived log file is removed if the maximum number of archived files is reached. The default setting is 1. (http://logging.apache.org/log4net/log4net-1.2.15/release/sdk/html/P_log4net_Appender_RollingFileAppender_MaxSizeRollBackups.htm)
* log4net > appender > '''lockingModel''': By default, the server log works in the ''ExclusiveLock'' mode, i.e. the log file is reserved by the QPR ProcessAnalyzer process for the entire time QPR ProcessAnalyzer is running. Thus it's not possible to edit or delete log files during that time.
* log4net > appender > '''lockingModel''': By default, the server log works in the ''ExclusiveLock'' mode, i.e. the log file is reserved by the QPR ProcessAnalyzer process for the entire time QPR ProcessAnalyzer is running. Thus it's not possible to edit or delete log files during that time.
==Send logs to OpenTelemetry==
Application writes traces and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint
* Standard traces:
** _Microsoft.EntityFrameworkCore_ - to trace EntityFramework queries
** _Microsoft.AspNetCore_ - to trace ProcessAnalyzer API calls
* ProcessAnalyzer traces:
** _QPR.ProcessAnalyzer.ExpressionQuery_ - to trace expression query evaluation
** _QPR.ProcessAnalyzer.DatabaseOperation_ - to trace queries to external data source
** _QPR.ProcessAnalyzer.ExpressionLanguage_ - to trace calls to Expression Language functions and properties
* If endpoint is not configured then traces are not collected and exported.
* Application writes metrics and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint
* Standard metrics that should be written:
** _Microsoft.AspNetCore_ - to track ProcessAnalyzer API calls
** _Microsoft.EntityFrameworkCore_ - to track EntityFramework status
** _Microsoft.Data.SqlClient.EventSource_ - to track SqlClient status
* If endpoint is not configured then metrics are not collected and exported.
* Environment variables to control collecting and exporting telemetry data using [OpenTelemetry Protocol Exporter](https://opentelemetry.io/docs/specs/otel/protocol/exporter/)
** `OTEL_EXPORTER_OTLP_ENDPOINT` - sends all signals to the same collector
** `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - collector endpoint for traces
** `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - collector endopint for metrics

Revision as of 10:33, 24 November 2025

QPR ProcessAnalyzer uses the log4net component (https://logging.apache.org/log4net/) for logging, allowing to flexibly define what is logged and where the logs are stored.

Write logs to file

For example, the following settings can be set in the log4net.config file (located in the bin folder in the server application files):

Send logs to OpenTelemetry

Application writes traces and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint

  • Standard traces:
    • _Microsoft.EntityFrameworkCore_ - to trace EntityFramework queries
    • _Microsoft.AspNetCore_ - to trace ProcessAnalyzer API calls
  • ProcessAnalyzer traces:
    • _QPR.ProcessAnalyzer.ExpressionQuery_ - to trace expression query evaluation
    • _QPR.ProcessAnalyzer.DatabaseOperation_ - to trace queries to external data source
    • _QPR.ProcessAnalyzer.ExpressionLanguage_ - to trace calls to Expression Language functions and properties
  • If endpoint is not configured then traces are not collected and exported.
  • Application writes metrics and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint
  • Standard metrics that should be written:
    • _Microsoft.AspNetCore_ - to track ProcessAnalyzer API calls
    • _Microsoft.EntityFrameworkCore_ - to track EntityFramework status
    • _Microsoft.Data.SqlClient.EventSource_ - to track SqlClient status
  • If endpoint is not configured then metrics are not collected and exported.
  • Environment variables to control collecting and exporting telemetry data using [OpenTelemetry Protocol Exporter](https://opentelemetry.io/docs/specs/otel/protocol/exporter/)
    • `OTEL_EXPORTER_OTLP_ENDPOINT` - sends all signals to the same collector
    • `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - collector endpoint for traces
    • `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - collector endopint for metrics