How to add timestamp to production.log entries ?

Added by Herold Gray 2 months ago

Redmine version           3.4.11.stable
Ruby version              2.5.1-p57 (2018-03-29) [x86_64-linux-gnu]
Rails version             4.2.11.1

I've tried to setup /config/additional_environment.rb to add timestamp but still no date and time on each log line output ...

Any insight on correct syntax or how to setup config/environments/production.rb to add timestamp on log messages ?
Thank's

cat additional_environment.rb
# Copy this file to additional_environment.rb and add any statements
# that need to be passed to the Rails::Initializer.  `config` is
# available in this context.
#
config.logger.level = Logger::WARN
#   config.log_level = :warn
config.datetime_format = "%Y-%m-%d %H:%M:%S" 
#

Replies (1)

RE: How to add timestamp to production.log entries ? - Added by Herold Gray about 1 month ago

Solved. I've got timestamp on production log entries.
See https://www.redmine.org/issues/18055
Added these 6 lines at the end of .../config/environments/production.rb and restart redmine:

  config.log_level = :warn
  class Logger
  def format_message(severity, timestamp, progname, msg)
  "#{timestamp} (#{$$}) #{msg}\n" 
  end
  end

(1-1/1)