Danny Krämer
Philosopher gone Frontend Developer

Turn off DB_AUDIT Logs in SAP Commerce

Written by Danny Krämer

Date: 11/22/2024

SAP Commerce’s database audit logging can get really annoying. Every database interaction creates a DB_AUDIT log from the AuditbaleActionsHandler. Especially, if you want to debug a database heavy class, it can get really hard to find your beloved debug logs in between all the audit logs. But turning off the audit logs isn’t that easy.

I found this article about audit logging. It suggests to set the following properties:

log4j2.logger.auditableActionsHandler.name=de.hybris.platform.audit.actions.impl.Slf4jAuditableActionHandler
log4j2.logger.auditableActionsHandler.level=OFF

That did not work for me. Even after setting the properties in my local.properties I got all the logs. Also editing the Log4J config did not work. Then I found this note from SAP. The only thing that seems to work is to turn off the logging for every item type. But how do you know which types to set? Here is an easy step by step solution.

  1. You need to install xmlstarlet
sudo apt install xmlstarlet
  1. Go to your source
cd path/to/hybris/bin  
  1. Find all item types that are enabled for database audit logging.
find . -name "*-items.xml" | xargs xmlstarlet select -t -m "//itemtype" -n -v "concat(concat('dbaudit.', @code), '.disabled=true')" | sort | uniq > dbaudit.txt

You will get a text file dbaudit.txt with all item types and the dbaudit.<itemtype>.disbaled property set to true. Now, turn everything into lower case, and put them into your local.properties. Voila! The logging is gone.

sap commerce

software development

configuration