Posts

Showing posts with the label without restarting

How to change class log level in Hybris without restarting server?

Scenario Sometime to debug the production issue, we want to enable log level for certain classes which were not configured in local.properties and we hope we could do it without restarting Hybris server.

Solution Your hope will come true. Yes, we can do it simply through the groovy script. Go to HAC > Console > Scripting languagePast the below groovy scriptchange your full class in setLogger method setLogger("de.hybris.platform.jalo.flexiblesearch.FlexibleSearch", "DEBUG");execute the scriptimport org.apache.logging.log4j.*; import org.apache.logging.log4j.core.config.*; import de.hybris.platform.util.logging.log4j2.HybrisLoggerContext; //Example setLogger("de.hybris.platform.jalo.flexiblesearch.FlexibleSearch", "DEBUG"); public String setLogger(String logClass, String logLevel ) { final HybrisLoggerContext loggerCtx = (HybrisLoggerContext) LogManager.getContext(false); final Configuration loggerCfg = loggerCtx.getConfig…