Project

General

Profile

Changing the path of the logfile in Redmine 5

Added by Jaume Sabater 12 months ago

Hey everyone!

So I've been reading these forums1 and the installation documentation regarding how to change the default location of the production.log file from <install_dir>/log/production.log to something else, e.g. a log dir outside the installation directory.

And all the information I've found in the forums seems outdated. Or I am not interpreting it correctly.

So, in the latest version of Redmine 5.0-stable as of today, I am configuring the config/additional_environment.rb with the following content:

# Logger.new(PATH, NUM_FILES_TO_ROTATE, FILE_SIZE)
config.logger = Logger.new('{{ redmine_log }}/production.log')
config.logger.level = Logger::INFO

I am omitting the number of files to rotate and the file size because I want to handle that using logrotate. I don't want to create a different log file, but to move the location of the default one.

Questions:

  1. Is the configuration above correct to achieve what I've described?
  2. Which variable can I use to set the file name to the environment, e.g. production in this case?
  3. What happened to config.log_path and config.paths['log']? I cannot seem to find references to that in the source code. Has it been changed? Where in the source code is the default logger set?

Thanks in advance.

[1] https://www.redmine.org/boards/2/topics/49809
[2] https://www.redmine.org/boards/2/topics/11836