Bug 32057: Add optional stack trace to action logs
authorKyle Hall <kyle@bywatersolutions.com>
Tue, 1 Nov 2022 10:47:35 +0000 (06:47 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 14 Mar 2023 11:49:32 +0000 (08:49 -0300)
commit1942dbe881401cce80533a5bfacba701738dcdc7
treeea64a2da81af4e065ecdf511aaeb4fb515044890
parent6d1890fc8e09be2c16677c9a0f4f71e70b3696b4
Bug 32057: Add optional stack trace to action logs

It can be useful to know where in Koha a particular logged action was generated from, and how. We should add the ability to attach a syspref controlled basic stack trace with the caller depth controlled via the syspref. We can the call caller() until the specified depth has been reached.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
4) Restart all the things!
5) Set the new syspref ActionLogsTraceDepth to a number ( e.g. 3 )
6) Update a syspref or trigger another enabled log action
7) Query the database: SELECT * FROM action_logs WHERE trace IS NOT NULL
8) Note the stack trace was created!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Log.pm
installer/data/mysql/atomicupdate/bug_32057.pl [new file with mode: 0755]
installer/data/mysql/kohastructure.sql
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref