A note from 2026: This article was published in 2016 for hybris 6.0/6.1. SAP Commerce Cloud has since replaced the “hybris” branding, and runtime access patterns differ in cloud environments; direct server-side scripts like this are mainly relevant to on-premise or locally hosted SAP Commerce installations.

[See also the newer article with the Groovy Script for the same purpose]

Introduction

Starting with version 6.0, SAP changed the architecture of the hybris logging subsystem. Hybris uses the Apache Log4j 2 logging framework, which is configured differently in hybris. Any changes in the logging configuration are applied only if the server is restarted.

Starting with hybris 6.0, the architecture of the Hybris Administrative Console (HAC) was changed. As a consequence, the logging configuration capabilities were restricted. For example, in previous versions, you were able to change the log level for all the beans defined in the system: thousands of items. For reasons that remain a mystery to me, in hybris 6.0/6.1 HAC shows only the root loggers, numbering 14 items.

For example, according to the documentation, if you want to turn logging on for de.hybris.platform.jalo.flexiblesearch.FlexibleSearch with logLevel = WARN, you need to add the following fragment to the configuration file. This example is for the property configuration file:

log4j2.logger.hmc.name = de.hybris.platform.jalo.flexiblesearch.Flex
log4j2.logger.hmc.level = warn
log4j2.logger.hmc.appenderRef.stdout.ref = STDOUT

Challenge

Logging is a very efficient tool for troubleshooting, so I was really frustrated to wait every single time I needed to add or change the logging settings. It is very annoying.

So I took up the challenge of creating a logging tool that simplifies common log operations and management.

hybrisLog

Usage examples

Display the hybris log, like tail -f.

./hybrisLog

Or, for non-wrapped output:

./noWrap ./hybrisLog

hybrisLog output in terminal

You can use filters (grep, egrep) or data processors (awk, perl) to make the log more focused on the problem you are dealing with:

./hybrisLog | grep "[FlexibleSearch]" | grep -i "{ContentPage}"

Show all classes that are loggable and registered in Apache Log4j.

./hybrisLog -a

There are thousands of classes in the output, so you can use filters to narrow them down:

./hybrisLog -a | grep "FlexibleSearch"

Filtering loggable FlexibleSearch classes

Show all custom log configurations. If you change the default logging configuration by using the utility or changing the local.property file, the list of custom configurations will change too.

./hybris -l

Custom log configurations

Change the log level for the specified class or package: a fully qualified class name or the package name.

./hybris -c <classOrPackage> -ll <logLevel>

Example:

./hybrisLog.sh -c de.hybris.platform.jalo.flexiblesearch.FlexibleSearch -ll INFO

./hybrisLog.sh -c de.hybris.platform.solrfacetsearch.indexer -ll DEBUG

Please note that the last command performs a bulk change for all classes in the de.hybris.platform.solrfacetsearch.indexer package:

hybrisLog bulk log level change for a package

© Rauf Aliev, August 2016