Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Run liferay 7.0 logging using local time
Is there a way to setup liferay logging to use local time instead onUTC. I don't the want to change liferay's overall timezone. I want to keep it UTC. Only want to change logging so it syncs up better in ELK with all the other log information we collect. Please note if it were up to me I'd just use UTC everywhere. This is coming from higher ups.
Sure thing! But you have to work to get it there...
Basically you need to use a custom logger definition such as:
Basically you need to use a custom logger definition such as:
<appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="log/volt.log">
<param name="DatePattern" value="'.'yyyy-MM-dd">
<layout class="[b][b]org.apache.log4j.EnhancedPatternLayout[/b][/b]">
<param name="ConversionPattern" value="[b][b]%d{ISO8601}{GMT-5}[/b][/b] %-5p [%t] %c: %m%n">
</layout>
</appender>
You need to override the portal's logging using either a webapps/ROOT/WEB-INF/classes/META-INF/portal-log4j-ext.xml file (to change Liferay's core loggers), but with Liferay 7 there are additional ways to update module logging if you only need logs from a specific module to be formatted differently.
Thanks David!
Can I externalize the portal-log4j-ext.xml like the portal-ext.properties file?
Unfortunately not.
Bummer but thanks again.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™