To get correct timestamps in logs in containers, TZ variable need to be set to the timezone that the user is located and starts Easy2Use from.
One example of implementation in Easy2Use Cli is to update (easy2use root dir)/config-default.bash script with following content:
if [ $(uname -s) == Linux ]
then
Getting the current computers timezone and apply it to all containers, so all logs and printouts timestamps bases on same timezone as the users computer/server timezone.
TZ_TEMP=$(cd /usr/share/zoneinfo && find * -type f -exec sh -c "diff -q /etc/localtime '{}' > /dev/null && echo {}" \;)
export TZ=$(echo $TZ_TEMP | head -n 1)
# TODO: How to get timezone when executed from windowns ? Currently when executed on windows, containers uses a default timezone.
# NOTE!: All containers need to be seeded with environment variable 'TZ' to apply timezone to the conatiners.
else
If it is not possible to get the users local timezone, then timezone is set to default timezone UTC.
# For windows TZ timezone need to be extracted from somewhere.
# Or windows users can maybe set timezone manual by a cli flag?
export TZ="UTC"
fi
And inject that variable to each container that is started in each bundle.
Description
To get correct timestamps in logs in containers, TZ variable need to be set to the timezone that the user is located and starts Easy2Use from.
One example of implementation in Easy2Use Cli is to update (easy2use root dir)/config-default.bash script with following content: if [ $(uname -s) == Linux ] then
Getting the current computers timezone and apply it to all containers, so all logs and printouts timestamps bases on same timezone as the users computer/server timezone.
else
If it is not possible to get the users local timezone, then timezone is set to default timezone UTC.
fi
And inject that variable to each container that is started in each bundle.
Motivation
Exemplification
Benefits
Log timestamps is set to the user local timezone.
Possible Drawbacks