We are using Application Insights for logging for all the microservices which work fine and data is not that too large. But when We send our SAP Hybris Commerce logs(6.7 version) it is sending the humongous amount of logs to Application Insight(more than 100 GB) for INFO level which is creating huge costs just for logging. Please provide some ways to reduce the not useful Hybris logs to be sent to Azure Application Insights. Please suggest what can be the best solution for this.
1 Answers
I do not see any reason why you should keep the logging level of INFO
in production. As you can see the in the image below, Log4j
differentiates five such log levels (in ascending order): DEBUG, INFO, WARN, ERROR, FATAL, NONE
.
You should change the logging level of the classes to ERROR
which will enable only ERROR
and FATAL
to be captured. In production, at most it should be WARN
which will enable only WARN
, ERROR
and FATAL
logs to be captured.
How to change log level?
There are two ways to do it:
Temporary: Login to hAC (Hybris Admin Console) ▸ Platform ▸ Logging and search the fully-qualified name of a class (e.g.
de.hybris.platform.jalo.flexiblesearch.FlexibleSearch
) and then change its logging level. This change will remain effective until you restart the server. Another way to do it temporarily is by using scripting but it requires knowledge of thegroovy
script.Permanent: Put the configurations into the
local.properties
file. Note that it will require restarting the server to become effective. A sample configuration:log4j.logger.my.package = WARN log4j.logger.org.training.service.MyServiceImpl = ERROR
Further reading: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/6.7.0.0/en-US/8c07853c866910148a00baf81ea1669e.html