aah Log Configuration

The configuration syntax is used by aah framework is very similar to HOCON syntax. To learn more about configuration syntax.

This document describes aah log configurations. Typically log configuration done at every environment profile level and you override it via external config file.

Reference to App Config, Routes Config, Security Config.


Receiver is where the log values gets logged. Out-of-the-box framework supports console and file receivers. Also you can add Hooks into per aah logger instance, for sending log data to splunk, kibana, etc.

Default value is console.

receiver = "file"


Level indicates the logging levels like ERROR, WARN, FATAL, PANIC, INFO, DEBUG and TRACE. Config value can be in lowercase or uppercase.

Default value is DEBUG.

level = "info"


To define log entry output format. Supported formats are text and json.

Default value is text.

format = "json"


Pattern config is defined composable log pattern. Patten flag is used as %flagname or %flagname:format.

Supported log patterns are:

FmtFlags is the list of log format flags supported by aah log library
Usage of flag order is up to format composition.
  level     - outputs ERROR, WARN, FATAL, PANIC, INFO, DEBUG, TRACE
  appname   - outputs Application Name
  insname   - outputs Application Instance Name
  reqid     - outputs Request ID from HTTP header
  principal - outputs Logged-In subject primary principal value
  time      - outputs local time as per format supplied
  utctime   - outputs UTC time as per format supplied
  longfile  - outputs full file name: /a/b/c/d.go
  shortfile - outputs final file name element: d.go
  line      - outputs file line number: L23
  message   - outputs given message along supplied arguments if they present
  fields    - outputs field values into log entry
  custom    - outputs string as-is into log entry

Note: Log pattern is not applicable of JSON log format.

Default value is %time:2006-01-02 15:04:05.000 %level:-5 %message.

pattern = "%time:2006-01-02 15:04:05 %level:-5 %shortfile %line %custom:- %message"


Log colored output, applicable only to console receiver type.

Default value is true.

color = false


File config attribute is applicable only to file receiver type.

Default value is aah-log-file.log.

file = "myapp.log"

Section: rotate { … }

Rotate config section is applicable only to file receiver type.


Policy is used to determine rotate policy. Currently it supports daily, lines and size.

Default value is daily.

# daily rotation, it's default one.
rotate {
  policy = "daily"

# size based rotation
rotate {
  policy = "size"
  size = "512mb"

# line based rotation
rotate {
  policy = "lines"
  lines = 100000


This is applicable only to if policy is size.

Default value is 512mb.

size = "100mb"


This is applicable only to if policy is lines.

Default value is 100000.

lines = 50000