-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed as not planned
Description
Describe the bug
Logging file channel logs using UTC time even though it is configured to use local time by setting logging.channels.file.times = local
. For console channel it is not possible to specify times
parameter.
To Reproduce
Add this configuration and compare times in logs with actual time.
logging.channels.file.class = FileChannel
logging.channels.file.pattern = %Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.file.path = ${application.dir}log/${application.baseName}.log
logging.channels.file.rotation = daily
logging.channels.file.archive = number
logging.channels.file.purgeCount = 10
logging.channels.file.times = local
Expected behavior
When logging.channels.file.times = local
is configured, timestamps in log file should be using local time. Also times
parameter should be supported in console channel.
Currently workaround this issue is to use PatternFormatter
.
Example configuration:
logging.channels.file.class = FileChannel
logging.channels.file.path = /var/log/devs/${application.baseName}.log
logging.channels.file.formatter.class = PatternFormatter
logging.channels.file.formatter.pattern = %Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.file.formatter.times = local
logging.channels.file.rotation = daily
logging.channels.file.archive = number
logging.channels.file.purgeCount = 10
logging.channels.console.class = ColorConsoleChannel
logging.channels.console.formatter.class = PatternFormatter
logging.channels.console.formatter.pattern = %Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.console.formatter.times = local