logs.adoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. [#log-levels]
  2. = Logging - Application
  3. [NOTE]
  4. There are two different types of logs in OliveTin - xref:advanced_configuration/logs.adoc[application logs] and xref:logs/actions.adoc[action logs]. This page is about the __application logs__, which are the logs that OliveTin itself generates. The action logs are the logs that are generated by the actions that you run in OliveTin.
  5. OliveTin supports a few different log levels. The default logLevel is `INFO`.
  6. Before configuration is loaded, OliveTin also logs at `INFO` by default. Pass `-startuptrace` if you need `TRACE` messages while OliveTin is searching for and loading `config.yaml` (for example to see which config paths were checked). After configuration loads, `logLevel` from `config.yaml` takes over as usual.
  7. .`Example: enable startup TRACE logging`
  8. [source,bash]
  9. ----
  10. OliveTin -startuptrace -configdir /etc/OliveTin
  11. ----
  12. You can set a `logLevel` in config.yaml like this;
  13. .`config.yaml`
  14. [source,yaml]
  15. ----
  16. logLevel: "INFO"
  17. actions:
  18. ....
  19. ----
  20. The supported log levels are;
  21. * `TRACE` - Extremely detailed messages (for example config decode hooks). Usually only useful with `-startuptrace`.
  22. * `DEBUG` - Every possible log message will be shown. This will use a lot of disk space and is not recommended unless you are a developer / like reading code.
  23. * `ERROR` - OliveTin rarely uses the `ERROR` log level.
  24. * `WARN` - Very few messages, only warnings are shown.
  25. * `INFO` - The defualt log level.
  26. You can change the `logLevel` while OliveTin is running, and it should update as soon as you save your config.yaml. You will always get a log message like this;
  27. [source,bash]
  28. ----
  29. INFO Setting log level to warning
  30. ----
  31. == JSON Log Format
  32. * OliveTin 2k supports JSON log format from version **2025.10.30**.
  33. * OliveTin 3k supports JSON log format from version **3000.2.2**.
  34. You can enable JSON log format by setting the `OLIVETIN_LOG_FORMAT` environment variable to `json`.
  35. [source,bash]
  36. .Example of setting `OLIVETIN_LOG_FORMAT` to `json`.
  37. ----
  38. root@server: ./OliveTin
  39. {"commit":"nocommit","date":"nodate","level":"info","msg":"OliveTin initializing","time":"2025-10-30T10:09:55Z","version":"dev"}
  40. {"level":"info","msg":"Setting log level to info","time":"2025-10-30T10:09:55Z"}
  41. {"level":"info","msg":"OliveTin initialization complete","time":"2025-10-30T10:09:55Z"}
  42. {"configDir":"/home/xconspirisist/sandbox/Development/OliveTin/OliveTin","level":"info","msg":"OliveTin started","time":"2025-10-30T10:09:55Z"}
  43. ----