Skip to Content
Former Member
Apr 19, 2017 at 12:37 PM

Customize appenders for log4j2



I'd like to customize the appenders for the logs of my own classes in hybris 6. But I've not been able to do that.

I tried the following:

 @RequestMapping(value = "/**/p")
 public class ProductPageController extends AbstractPageController
     private static final Logger LOG = LogManager.getLogger(ProductPageController.class);

My config/ is:

 log4j2.appender.file.type= RollingFile = FILE
 log4j2.appender.file.layout.type = PatternLayout
 log4j2.appender.file.layout.pattern = [%d{ISO8601}]%5p%6.6r[%t]%x(%F:%L) - %m%n
 log4j2.appender.file.filePattern =${sys:HYBRIS_LOG_DIR}/tomcat/infolog-%d{yyyyMMdd}.log
 log4j2.appender.file.policies.type = Policies
 log4j2.appender.file.policies.time.type = TimeBasedTriggeringPolicy
 log4j2.appender.file.strategy.type = DefaultRolloverStrategy
 log4j2.appender.file.filters = threshold
 log4j2.appender.file.filter.threshold.type = ThresholdFilter
 log4j2.appender.file.filter.threshold.level = info = com.hiberus.suavinex.storefront.controllers.pages
 log4j2.logger.log-product.level = INFO
 log4j2.logger.log-product.appenderRef.file.ref = FILE

I get nothing. I can see the logs in console, but I'd like to see it in my own file.

I read other questions, followed the instructions... and nothing... Can anyone help me?

Thanks in advance!