Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is possible to configure logging to a file by setting a JVM parameter logging.file.name. By default, Blueriq uses a size and time based policy so each 10MB and each day the log file will rotate. There are lots of ways to tweak and tune the logging, either by setting some additional properties or overriding the Logback configuration. For more info, please refer to the myBlueriq source.

Log details

The following items are logged by default:

...

  1. tenantName (name of the tenant that is used, see Multi-tenancy). If you use multi-tenancy and if you want to log the tenant name with each log line, you can add tenantName="%X{tenantName}" to the LOG_PATTERN property in your custom logback-spring.xml file.

Example output

2019-04-23 02:45:34.595 INFO    c.a.i.portal.model.session.FlowHandler httpSessionId="FAA05342917D2C3E6775FE3346E83F12" runtimeSessionId="4c2fff20-26c9-4a3e-88c0-8bba58504de9" userId="anonymousUser" projectName="export-AQ_12267_SoapServiceClient_Project2" projectVersion="Trunk" currentPageName="Home" [trace=93e68ee796b28b16,span=93e68ee796b28b16] - [onFlowStart] Starting flow: HandleEvent

Default Logback configuration for Java

By default the following logback-spring.xml file is packaged in the Runtime WAR:

...

Code Block
languagetext
titleapplication.properties
# Set this to (let Spring Boot) use a logback-spring.xml that does NOT come from the classpath
logging.config=D:/spring/config/location/logback-spring.xml

Enabling logging to a file

The Runtime by default only logs to the console. To enable logging to a file, you can either add a property to application.properties or set the logging.file.name property as a JVM parameter. Note that an absolute path to the logfile is required.

...

Code Block
languagetext
titleJVM parameter
-Dlogging.file.name=D:/temp/runtime.log

Preventing Log Injection

To prevent Log Injection attacks, since Blueriq 12.10, you can configure the following in logback-spring.xml:

...

Code Block
languagexml
titlepom.xml
<!-- OWASP Security Logging Logback -->
<dependency>
    <groupId>org.owasp</groupId>
    <artifactId>security-logging-logback</artifactId>
    <version>LATEST</version>
    <scope>runtime</scope>
</dependency>

Limiting the logfile archive

If you want to limit the number of logfiles to be archived, you can do this by setting the <maxHistory> property in the logback-spring.xml that is being used. You can also limit the archive by setting the max capacity of the total archive with the <totalSizeCap>. Both properties should be configured inside the rollingPolicy tag, see https://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy for more information.

Log level overrides

If you want to change the log level for the entire application or for certain portions of the application, you can do so in the logback-spring.xml file.

Override the log level for the entire application

In the <root> tag, you can change the level to ERROR, WARN, INFO, DEBUG or TRACE. INFO is the default. For more logging, choose DEBUG or TRACE. For less logging, choose ERROR or WARN.

Override the log level for certain portions

You can change the log level for a portion of the application. First you should identify the package prefix of the portion. You can find it in the log messages. In most use cases, the prefixes com.aquima and com.blueriq will be overridden.

To override a portion, add a line like <logger name="com.blueriq" level="INFO"/> to the logback-spring.xml, as can be seen in the example above. You should configure the log level to suit your needs.

Alternative way of setting log level overrides

Log level overrides can also be set in application.properties:

...