RE: RE: How to Log Server Start/Stop time in Database

تم تعديل Jamie Sammons منذ 4 سنوات من الدقائق. New Member المشاركات: 11 تاريخ الإنضمام: 12‏/2‏/20 المشاركات الحديثة

Use Case:
We want  to Log Server Start/Stop time in database.

Example: for Normal Web-App we use "ServletContextListener" which get triggered at server start/stop and log time in DB.
 

Explanation: 
I like to log server start/stop time,
do Liferay has "ServletContextListener" like feature
OR is there any Inbulit Method from where I can fetch the server start and stop time 

thumbnail
تم تعديل Mohammed Yasin منذ 4 سنوات من الدقائق. Liferay Master المشاركات: 593 تاريخ الإنضمام: 8‏/8‏/14 المشاركات الحديثة

Hi ,
You can get the time when the  Liferay was started from PortalUtil.getUptime(). In case you need an event to capture this, then you can look into the Global Start up event that runs once when the portal initializes.

https://help.liferay.com/hc/en-us/articles/360035828151-Liferay-DXP-Startup-Phases#portal-startup-events

تم تعديل Jamie Sammons منذ 3 سنوات من الدقائق. New Member المشاركات: 11 تاريخ الإنضمام: 12‏/2‏/20 المشاركات الحديثة

Thanks,
for the response, just curious to know do we have any stop time as well, 

thumbnail
تم تعديل Mohammed Yasin منذ 3 سنوات من الدقائق. Liferay Master المشاركات: 593 تاريخ الإنضمام: 8‏/8‏/14 المشاركات الحديثة

Hi ,

You can capture that from Global Shut Down event , You can refer below property

https://docs.liferay.com/dxp/portal/7.4-latest/propertiesdoc/portal.properties.html#Shutdown%20Events