how to change system timezone

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

hi 

i changed timezone from control panel > instance settings > localization > virtual instance scope > timezone

but the log print out still use gmt timezone, it will make me harder to tracing issue.

is there anyway to change timezone? 

i found in property company.default.time.zone from  server administration > properties > portal properties

but i don't know how to change it, in portal-ext.properties? or in portal-setup-wizard.properties than restart server?

thanks in advance

thumbnail
Scarletake Bwi, modified 3 Years ago. Liferay Master Posts: 753 Join Date: 1/9/14 Recent Posts

The time zone configured at instance level (control panel > instance settings > localization > virtual instance scope > timezone) only applies to the user interface for the new created users.

If you want to change the timezone of the log traces, you have to change the portal-log4j.xml configuration.

Here there is a HelpCenter article that explains how to configure it Changing the Log Time Zone Without Changing the JVM Time Zone (it will need a HelpCenter user)

Important, never set the time zone at JVM level, as it can cause Liferay issues, see these HelpCenter articles: Issues With Setting Time Zone Settings on the JVM Level and Can I change the JVM Time Zone?

 

Alla Sapozhnikova, modified 3 Years ago. Junior Member Posts: 82 Join Date: 3/2/12 Recent Posts

Hi there,

 

I changed my portal-log4j-ext.xml as suggested

	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
		<layout class="org.apache.log4j.EnhancedPatternLayout">
			<param name="ConversionPattern" value="%d{ABSOLUTE}{EDT} %-5p [%t][%c{1}:%L] %m%n" />
		</layout>
	</appender>

	<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
		<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
			<param name="FileNamePattern" value="@liferay.home@/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log" />
		</rollingPolicy>

		<layout class="org.apache.log4j.EnhancedPatternLayout">
			<param name="ConversionPattern" value="%d{ABSOLUTE}{EDT} %-5p [%t][%c{1}:%L] %m%n" />
		</layout>
	</appender>

	<root>
		<priority value="INFO" />
		<appender-ref ref="CONSOLE" />
		<appender-ref ref="FILE" />
	</root>

Restarted portal. But the log still uses the GMT timezone.

What am I missing?

Thank you.

Alla