Acrolinx has two log modes: a default mode and a structured logging mode.
The default logging is meant for technical users. If you don't change the configuration in the logback.xml
file, the logs are written to the githubhook.log
file in the directory where the application starts. You can modify the base name of the file with the environment variable ACROLINX_LOGGING_FILE_BASE_NAME
(unless you use your own logback.xml
configuration). The default value is githubhook
.
The file logback-stdout.xml located inside the integration JAR file can be used to redirect the log output. It is on the classpath and can be used as follows:
java -Dlogback.configurationFile=logback-stdout.xml -jar JARFILE ...
This will redirect the log output to standard output.
You can set the log level with the environment variable ACROLINX_LOGGING_LEVEL
. The default value is INFO
. For more information about which confidential data might be written to the logs with various log levels, contact Acrolinx Support.
A default logging configuration comes with the program. It uses a default logback.xml
that you can generate with the command-line option --sample-log
.
If you want to modify the logback.xml
configuration, you can specify a properties file on the command line:
Note
The default logback.xml
file monitors itself. Any change to this file applies after no more than 2 minutes.
java -Dlogback.configurationFile=./logback.xml -jar githubhook.jar
-
This setting must appear before the
-jar
option. -
Define the path relative to the directory where you start the server. That way, Logback can find it. Another example could be
.../config/logback.xml
. Note the leading dot or dots. -
The file-based configuration is monitored. So, you can adjust the logging at runtime and the changes are applied up in a few seconds.
-
The program uses some heuristics to display the logs in the dashboard. This may fail if you change the default configuration too much.
Structured logging helps you monitor and locate issues in a production environment. You can use it when all of your logs are sent to a monitoring system that accepts a JSON input.
The naming schema of the JSON attributes works well with the monitoring platform Datadog. Datadog uses a hierarchical format separated by colons. It includes underscores to separate names. Here’s an example of a log line:
{"timestamp":"2021-05-23T13:48:28.504168Z","status":"debug","message":"Init Acrolinx client (new API) ","namespace":"com.acrolinx.githubhook","com.acrolinx.githubhook.structured_logging.original_message":"Init Acrolinx client (new API)","com.acrolinx.githubhook.schema.process_start_time":"2021-05-23T13:48:27.580028Z","com.acrolinx.githubhook.schema.process_uuid":"313159fb-3b3b-449e-bf7c-0b95364964f1","com.acrolinx.githubhook.schema.version_info":"com.acrolinx/githubhook version 3.2.0"}
Note
Note that the timestamp is now strictly ISO 8601 compliant to make it easier to integrate into other systems.
To enable structured logging, you can set the environment variable ACROLINX_LOGGING_MODE
to the value structured
. Do this before you start the application. This environment variable accepts the values structured
(JSON format) and basic
(easy-to-read format). The default value is basic
.
Example: EDN format
env ACROLINX_LOGGING_MODE=structured java -jar build/libs/githubhook.jar --config config.edn
Example: JSON format
env ACROLINX_LOGGING_MODE=structured java -jar build/libs/githubhook.jar --config config.json
If you're using your own logback.xml
file to configure the log output, you need to suppress the output of the timestamp and log level. That’s because each JSON line already includes this information.
<encoder> <pattern>%m%n</pattern> </encoder>
Note
The attribute names documented here are likely to change. Contact Acrolinx if you need stable attributes for postprocessing or Datadog configuration.
Acrolinx offers an unprotected HTTP endpoint that you can use with a monitoring tool to monitor the size of the queue. The URL is /health
, for example http://localhost:9779/health
.
The HTTP response is a plain text document. It includes the number of items in the queue followed by an equal number of dots ('.') that correspond to each item. This allows you to either parse the integer or raise an alarm based on the size of the response. The size is often a standard mechanism in monitoring systems.
With Acrolinx for Git hosting providers, you can report some metrics to StatsD. Use this to show runtime metrics in some monitoring tools if they support data reading from StatsD.
To do this, you need to set the configuration variable :statsd-host
. If you run StatsD on a port other than 8125, you can set :statsd-port
. You need to set the host to start the StatsD client.
StatsD metrics and service checks are for normal webhook operations and during baseline checking.