Project

General

Profile

Actions

Improvement #810

closed

Change logging to file by default

Added by liaham about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Compatible Redmine Version:

Description

Currently, xmera Omnia loggs both to STDOUT and file:

  logfile = Rails.root.join("log", "#{Rails.env}.log")
  console_logger = ActiveSupport::Logger.new(STDOUT)
  file_logger = ActiveSupport::Logger.new(logfile)
  config.logger = console_logger.extend(ActiveSupport::Logger.broadcast(file_logger))
  config.datetime_format = "%Y-%m-%d %H:%M:%S"
  config.log_level = ENV.fetch("LOG_LEVEL", "DEBUG")
  config.log_tags = [:request_id]

This will give to much information when running some rake tasks for example.

Actions #1

Updated by liaham almost 3 years ago

Its now:

require "active_support/core_ext/numeric/bytes"

config.log_file = Rails.root.join("log", "#{Rails.env}.log")
# Rotate either over the number of old log files to keep or
# the frequency: daily, weekly, monthly
config.log_file_rotation = 1
config.max_file_size = 50.megabytes
console_logger = ActiveSupport::Logger.new(STDOUT)
file_logger = ActiveSupport::Logger.new(config.log_file,
                                        config.log_file_rotation,
                                        config.max_file_size)
# If required, change the logger to console_logger instead.
config.logger = file_logger
Actions #2

Updated by liaham almost 3 years ago

  • Status changed from New to Closed
  • Assignee set to liaham
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF