In this blog post I will describe how you can perform a simple change in SAP Commerce which allows you to change the log level for all nodes at the same time.
As you might know, you can change the log level of a logger during runtime in Hybris Adminstration Console (HAC). Sadly, performing a change does only change the logger of the node where you are right now. All other nodes will keep the log level.
There are two workarounds. One is to login into all HACs of all nodes and perform the change on every node and the second is, you can maybe limit your test to a node/node group and only change the level on this node.
Both workarounds might work for you, but with maybe higher effort and it is also very errorprone if you forget a node or running on a different node than expected.
So, wouldn't it be easier if you had the chance to change the log level for all nodes at the same time? You will see, the necessary changes are quite easy.
How is it implemented currently?
In the HAC, there is a Controller method of the class Log4JController which is called:
If you compare this class with the standard HacLog4JFacade, you will see no important changes. I have basically copied the same code to the Listener and added some Log-Messages.
The only difference is now that the onEvent method will now be executed on all nodes in the cluster. When you perform the change you will directly see a log-level change in the logs depending on how much nodes you have in your cluster. This is independent of whether it is the EnPremise or Cloud installation.
The following screenshot will then show you how it would look like in Kibana in SCCv2. In my case, I had running 6 active nodes and changed the log level of com.sap.sce to DEBUG.
Kibana shows that all nodes are changing the log-level.
By enabling us to change the log level during runtime, we can now easily switch the verbosity of the SAP commerce environment. We can react to specific issue reports and change what and how much the running system writes into the log.
How do you think about it? Are you also often frustrated that you cannot change the log level during runtime on all nodes at once? Would you say that this should be the standard approach or at least configurable? Feel free to leave a note in this blog post.