Table of contents


Official Content

What are Logs?

A Log or log history is a text file (that can be structured or unstructured) in which the events, actions, or changes that have been generated are recorded chronologically.

In general, Logs can be used for several things. For example, to Trace, Debug, or communicate diagnostics of an application.

Logs in GeneXus

The various GeneXus Logs can be configured at runtime, for example, by using the Log level property and then doing a build.

To modify Logging Settings at Runtime without having to build and deploy the WebApp, you can use environment variables.

The basic environment variables are as follows:

Environment variables Description Values Availability
GX_LOG_LEVEL Configures how many details should be added to the log.
  • debug
  • all
  • info
  • warn
  • error
  • Java Generator (v18 U1)
  • .NET Generator (v18 U2)
GX_LOG_LEVEL_USER Configures the level of detail of the Log when using the Log API (Log external object); this is independent of the level of detail configured in the Log level property.
  • debug
  • all
  • info
  • warn
  • error
  • Java Generator (v18 U1)
  • .NET Generator (v18 U2)
GX_LOG_OUTPUT Indicates where to send the result of the Log Level property.
  • ConsoleAppender
    (Writes to SYSOUT)
  • RollingFile
    (Writes to File)
  • AZUREAPPLICATIONINSIGHTS (Available for .NET since GeneXus 18 upgrade 7)
  • Java Generator (v18 U1)
  • .NET Generator (v18 U2)

 

**When a LogLevel is specified, logging is enabled for messages at the specified level and higher.

Besides, there are some considerations depending on the logging provider used that are explained below.

.NET Generator

In the case of the .NET generator, the environment variables that will be considered depend on the Observability Provider property value.

When the Observability Provider property is set to a value other than "none", log4net will not be used and will be replaced by the logging provider of Opentelemetry.

The same happens when Log output = Azure Application Insights. In this case, the provider used is not log4net; it is Azure Application Insights logging provider.

The following table shows the environment variables criteria applicable to both cases (using a logging provider other than log4net):

 

Environment variables Description Values
GX_LOG_LEVEL

Configures how many details should be added to the log.
This applies to both the Standard Classes logs and the logs generated by the Log API.

 

  • all (Trace)
  • debug (Debug)
  • info (Information)
  • warn (Warning)
  • error (Error)
  • fatal (Critical)

 

Sample EnvVar configuration

    GX_LOG_OUTPUT: ConsoleAppender
    GX_LOG_LEVEL: INFO
    GX_LOG_LEVEL_USER: INFO

Scope

Generators: Java, .NET

See Also

Application Configuration using Environment Variables in .NET and Java
Log output property
User Log level property
Log output property

Last update: November 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant