Project

General

Profile

Logfile timestamp and log level question

Added by Anonymous almost 11 years ago

Hi!

I am redmine using now for about 8 months and works very well. I inspect on a regular basis my logfiles in <redmine_path>/log and find that production.log has not been changed for the last 20 days. So I assume my instance is running very clean and smoothly.

My question is:
1. is it possible to have every line in logfile preceded by date-time? right now - if there are any entries - it would be very difficult to track the associated reason.
2. as my redmine being now "mute" for 20 days: is there a log level which can be changed so to verify that really everything is working smoothly?

Thanks a lot

Alex


Replies (4)

RE: Logfile timestamp and log level question - Added by Pero Postar about 6 years ago

Alex,

I know it's quite a long time ago, but - did you (and how) found answers to your questions?

RE: Logfile timestamp and log level question - Added by Herold Gray about 5 years ago

Pero Postar wrote:

Alex,

I know it's quite a long time ago, but - did you (and how) found answers to your questions?

+1 , any solution ?

RE: Logfile timestamp and log level question - Added by Herold Gray about 5 years 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

RE: Logfile timestamp and log level question - Added by Oliver Jayden about 5 years ago

I was dealing with the same issue myself. There are two ways I was able to do this.

When you include Winston, it usually defaults to adding a Console transport. In order to get timestamps to work in this default case, I needed to either: https://www.redmine.org/ https://www.dgcustomerfirst.review/

Remove the console transport and add again with the timestamp option.
Create your own Logger object with the timestamp option set to true.

    (1-4/4)