Server settings in log4net.config: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 8: Line 8:
* 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==
==Send logs, metrics and traces to OpenTelemetry==
Application writes traces and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint
 
* Standard traces:
QPR ProcessAnalyzer supports writing OpenTelemetry (https://opentelemetry.io/docs) logs, metrics and traces.
** _Microsoft.EntityFrameworkCore_ - to trace EntityFramework queries
 
** _Microsoft.AspNetCore_ - to trace ProcessAnalyzer API calls
=== Logs ===
* ProcessAnalyzer traces:
QPR ProcessAnalyzer can write logs using the OpenTelemetry exporter into the provided endpoint. If an endpoint is not configured, logs are not exported.
** _QPR.ProcessAnalyzer.ExpressionQuery_ - to trace expression query evaluation
 
** _QPR.ProcessAnalyzer.DatabaseOperation_ - to trace queries to external data source
The following environment variables are used to control collecting and exporting telemetry data using OpenTelemetry Protocol Exporter (https://opentelemetry.io/docs/specs/otel/protocol/exporter):
** _QPR.ProcessAnalyzer.ExpressionLanguage_ - to trace calls to Expression Language functions and properties
* '''OTEL_EXPORTER_OTLP_ENDPOINT''' sends all signals to the same collector.
* If endpoint is not configured then traces are not collected and exported.
* '''OTEL_EXPORTER_OTLP_TRACES_ENDPOINT''' collector endpoint for traces.
* Application writes metrics and uses [OpenTelemetry](https://opentelemetry.io/docs/) exporter to write them into provided endpoint
* '''OTEL_EXPORTER_OTLP_METRICS_ENDPOINT''' collector endpoint for metrics.
* Standard metrics that should be written:
* '''OTEL_EXPORTER_OTLP_LOGS_ENDPOINT''' collector endpoint for logs.
** _Microsoft.AspNetCore_ - to track ProcessAnalyzer API calls
 
** _Microsoft.EntityFrameworkCore_ - to track EntityFramework status
QPR ProcessAnalyzer writes logs with level '''WARN''' by default. Logs with level '''WARN''', '''ERROR''', and '''FATAL''' additionally written into Snowflake events table utilizing event's severity. Logs are written into container's stdout stream using JSON format for structured logging (https://learn.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter#json).
** _Microsoft.Data.SqlClient.EventSource_ - to track SqlClient status
 
* If endpoint is not configured then metrics are not collected and exported.
=== Metrics ===
* Environment variables to control collecting and exporting telemetry data using [OpenTelemetry Protocol Exporter](https://opentelemetry.io/docs/specs/otel/protocol/exporter/)
QPR ProcessAnalyzer can write metrics using the OpenTelemetry exporter into the provided endpoint.
** `OTEL_EXPORTER_OTLP_ENDPOINT` - sends all signals to the same collector
 
** `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - collector endpoint for traces
There are the following standard metrics:
** `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - collector endopint for metrics
* '''_Microsoft.AspNetCore_''' to track QPR ProcessAnalyzer API calls.
* '''_Microsoft.EntityFrameworkCore_''' to track EntityFramework status.
* '''_Microsoft.Data.SqlClient.EventSource_''' to track SQL Server client status.
 
If an endpoint is not configured, metrics are not collected and exported.
 
=== Traces ===
QPR ProcessAnalyzer can write traces using the OpenTelemetry exporter into the provided endpoint.
 
There are the following standard traces:
* '''_Microsoft.EntityFrameworkCore_''' to trace EntityFramework queries.
* '''_Microsoft.AspNetCore_''' to trace QPR ProcessAnalyzer API calls.
 
In addition, there are the following custom traces:
* '''_QPR.ProcessAnalyzer.ExpressionQuery_''' to trace expression language query evaluation.
* '''_QPR.ProcessAnalyzer.DatabaseOperation_''' to trace queries to external data source.
* '''_QPR.ProcessAnalyzer.ExpressionLanguage_''' to trace calls to expression language function and property calls.
 
If an endpoint is not configured, traces are not collected and exported.

Latest revision as of 09:54, 15 December 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, metrics and traces to OpenTelemetry

QPR ProcessAnalyzer supports writing OpenTelemetry (https://opentelemetry.io/docs) logs, metrics and traces.

Logs

QPR ProcessAnalyzer can write logs using the OpenTelemetry exporter into the provided endpoint. If an endpoint is not configured, logs are not exported.

The following environment variables are used 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 endpoint for metrics.
  • OTEL_EXPORTER_OTLP_LOGS_ENDPOINT collector endpoint for logs.

QPR ProcessAnalyzer writes logs with level WARN by default. Logs with level WARN, ERROR, and FATAL additionally written into Snowflake events table utilizing event's severity. Logs are written into container's stdout stream using JSON format for structured logging (https://learn.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter#json).

Metrics

QPR ProcessAnalyzer can write metrics using the OpenTelemetry exporter into the provided endpoint.

There are the following standard metrics:

  • _Microsoft.AspNetCore_ to track QPR ProcessAnalyzer API calls.
  • _Microsoft.EntityFrameworkCore_ to track EntityFramework status.
  • _Microsoft.Data.SqlClient.EventSource_ to track SQL Server client status.

If an endpoint is not configured, metrics are not collected and exported.

Traces

QPR ProcessAnalyzer can write traces using the OpenTelemetry exporter into the provided endpoint.

There are the following standard traces:

  • _Microsoft.EntityFrameworkCore_ to trace EntityFramework queries.
  • _Microsoft.AspNetCore_ to trace QPR ProcessAnalyzer API calls.

In addition, there are the following custom traces:

  • _QPR.ProcessAnalyzer.ExpressionQuery_ to trace expression language query evaluation.
  • _QPR.ProcessAnalyzer.DatabaseOperation_ to trace queries to external data source.
  • _QPR.ProcessAnalyzer.ExpressionLanguage_ to trace calls to expression language function and property calls.

If an endpoint is not configured, traces are not collected and exported.