Merge branch 'stable' into develop
This commit is contained in:
commit
70dc4fcab1
10 changed files with 124 additions and 17 deletions
|
|
@ -27,6 +27,7 @@ Ruby 2.0 is no longer officially supported.
|
||||||
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
|
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
|
||||||
* Improved handling of reshares with deleted roots [#5968](https://github.com/diaspora/diaspora/pull/5968)
|
* Improved handling of reshares with deleted roots [#5968](https://github.com/diaspora/diaspora/pull/5968)
|
||||||
* Remove two unused methods [#5970](https://github.com/diaspora/diaspora/pull/5970)
|
* Remove two unused methods [#5970](https://github.com/diaspora/diaspora/pull/5970)
|
||||||
|
* Refactored the Logger to add basic logrotating and more useful timestamps [#5975](https://github.com/diaspora/diaspora/pull/5975)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
||||||
|
|
|
||||||
7
Gemfile
7
Gemfile
|
|
@ -169,6 +169,10 @@ gem "mobile-fu", "1.3.1"
|
||||||
gem "will_paginate", "3.0.7"
|
gem "will_paginate", "3.0.7"
|
||||||
gem "rails-timeago", "2.11.0"
|
gem "rails-timeago", "2.11.0"
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
|
||||||
|
gem "logging-rails", "0.5.0", require: "logging/rails"
|
||||||
|
|
||||||
# Workarounds
|
# Workarounds
|
||||||
# https://github.com/rubyzip/rubyzip#important-note
|
# https://github.com/rubyzip/rubyzip#important-note
|
||||||
gem "zip-zip"
|
gem "zip-zip"
|
||||||
|
|
@ -280,4 +284,7 @@ group :development, :test do
|
||||||
gem "jasmine-jquery-rails", "2.0.3"
|
gem "jasmine-jquery-rails", "2.0.3"
|
||||||
gem "rails-assets-jasmine-ajax", "3.1.1", source: "https://rails-assets.org"
|
gem "rails-assets-jasmine-ajax", "3.1.1", source: "https://rails-assets.org"
|
||||||
gem "sinon-rails", "1.10.3"
|
gem "sinon-rails", "1.10.3"
|
||||||
|
|
||||||
|
# silence assets
|
||||||
|
gem "quiet_assets", "1.1.0"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -390,6 +390,12 @@ GEM
|
||||||
celluloid (~> 0.16.0)
|
celluloid (~> 0.16.0)
|
||||||
rb-fsevent (>= 0.9.3)
|
rb-fsevent (>= 0.9.3)
|
||||||
rb-inotify (>= 0.9)
|
rb-inotify (>= 0.9)
|
||||||
|
little-plugger (1.1.3)
|
||||||
|
logging (2.0.0)
|
||||||
|
little-plugger (~> 1.1)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
logging-rails (0.5.0)
|
||||||
|
logging (>= 1.8)
|
||||||
loofah (2.0.2)
|
loofah (2.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
lumberjack (1.0.9)
|
lumberjack (1.0.9)
|
||||||
|
|
@ -468,6 +474,8 @@ GEM
|
||||||
pry (~> 0.10)
|
pry (~> 0.10)
|
||||||
pry-debundle (0.8)
|
pry-debundle (0.8)
|
||||||
pry
|
pry
|
||||||
|
quiet_assets (1.1.0)
|
||||||
|
railties (>= 3.1, < 5.0)
|
||||||
rack (1.6.1)
|
rack (1.6.1)
|
||||||
rack-cors (0.4.0)
|
rack-cors (0.4.0)
|
||||||
rack-google-analytics (1.2.0)
|
rack-google-analytics (1.2.0)
|
||||||
|
|
@ -765,6 +773,7 @@ DEPENDENCIES
|
||||||
js_image_paths (= 0.0.2)
|
js_image_paths (= 0.0.2)
|
||||||
jshintrb (= 0.3.0)
|
jshintrb (= 0.3.0)
|
||||||
json (= 1.8.2)
|
json (= 1.8.2)
|
||||||
|
logging-rails (= 0.5.0)
|
||||||
markerb (= 1.0.2)
|
markerb (= 1.0.2)
|
||||||
messagebus_ruby_api (= 1.0.3)
|
messagebus_ruby_api (= 1.0.3)
|
||||||
mini_magick (= 4.2.3)
|
mini_magick (= 4.2.3)
|
||||||
|
|
@ -781,6 +790,7 @@ DEPENDENCIES
|
||||||
pry
|
pry
|
||||||
pry-byebug
|
pry-byebug
|
||||||
pry-debundle
|
pry-debundle
|
||||||
|
quiet_assets (= 1.1.0)
|
||||||
rack-cors (= 0.4.0)
|
rack-cors (= 0.4.0)
|
||||||
rack-google-analytics (= 1.2.0)
|
rack-google-analytics (= 1.2.0)
|
||||||
rack-piwik (= 0.3.0)
|
rack-piwik (= 0.3.0)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ module Workers
|
||||||
sidekiq_options backtrace: (bt = AppConfig.environment.sidekiq.backtrace.get) && bt.to_i,
|
sidekiq_options backtrace: (bt = AppConfig.environment.sidekiq.backtrace.get) && bt.to_i,
|
||||||
retry: (rt = AppConfig.environment.sidekiq.retry.get) && rt.to_i
|
retry: (rt = AppConfig.environment.sidekiq.retry.get) && rt.to_i
|
||||||
|
|
||||||
|
def logger
|
||||||
|
@logger ||= ::Logging::Logger[self]
|
||||||
|
end
|
||||||
|
|
||||||
# In the long term we need to eliminate the cause of these
|
# In the long term we need to eliminate the cause of these
|
||||||
def suppress_annoying_errors(&block)
|
def suppress_annoying_errors(&block)
|
||||||
yield
|
yield
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,10 @@ Diaspora::Application.configure do
|
||||||
|
|
||||||
# Expands the lines which load the assets
|
# Expands the lines which load the assets
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
||||||
|
# Set the logging destination(s)
|
||||||
|
config.log_to = %w[stdout file]
|
||||||
|
|
||||||
|
# Show the logging configuration on STDOUT
|
||||||
|
config.show_log_configuration = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ Diaspora::Application.configure do
|
||||||
# Log level
|
# Log level
|
||||||
config.log_level = :info
|
config.log_level = :info
|
||||||
|
|
||||||
|
# Set the logging destination(s)
|
||||||
|
config.log_to = %w[file]
|
||||||
|
|
||||||
|
# Show the logging configuration on STDOUT
|
||||||
|
config.show_log_configuration = false
|
||||||
|
|
||||||
# Prepend all log lines with the following tags
|
# Prepend all log lines with the following tags
|
||||||
# config.log_tags = [ :subdomain, :uuid ]
|
# config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
|
|
@ -66,7 +72,7 @@ Diaspora::Application.configure do
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
# For nginx:
|
# For nginx:
|
||||||
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"
|
||||||
|
|
||||||
if AppConfig.environment.assets.host.present?
|
if AppConfig.environment.assets.host.present?
|
||||||
config.action_controller.asset_host = AppConfig.environment.assets.host.get
|
config.action_controller.asset_host = AppConfig.environment.assets.host.get
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ Sidekiq.configure_server do |config|
|
||||||
|
|
||||||
# Make sure each Sidekiq process has its own sequence of UUIDs
|
# Make sure each Sidekiq process has its own sequence of UUIDs
|
||||||
UUID.generator.next_sequence
|
UUID.generator.next_sequence
|
||||||
|
|
||||||
|
Sidekiq.logger = Logging.logger[Sidekiq]
|
||||||
end
|
end
|
||||||
|
|
||||||
Sidekiq.configure_client do |config|
|
Sidekiq.configure_client do |config|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
if Rails.env.development?
|
|
||||||
|
|
||||||
Rails.application.assets.logger = Logger.new('/dev/null')
|
|
||||||
|
|
||||||
Rails::Rack::Logger.class_eval do
|
|
||||||
def call_with_quiet_assets(env)
|
|
||||||
previous_level = Rails.logger.level
|
|
||||||
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
|
|
||||||
call_without_quiet_assets(env)
|
|
||||||
ensure
|
|
||||||
Rails.logger.level = previous_level
|
|
||||||
end
|
|
||||||
alias_method_chain :call, :quiet_assets
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
85
config/logging.rb
Normal file
85
config/logging.rb
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
Logging::Rails.configure do |config|
|
||||||
|
# Configure the Logging framework with the default log levels
|
||||||
|
Logging.init %w(debug info warn error fatal)
|
||||||
|
|
||||||
|
# Objects will be converted to strings using the :inspect method.
|
||||||
|
Logging.format_as :inspect
|
||||||
|
|
||||||
|
# The default layout used by the appenders.
|
||||||
|
layout = Logging.layouts.pattern(pattern: "[%d] %-5l %c : %m\n")
|
||||||
|
|
||||||
|
# Setup a color scheme called 'bright' than can be used to add color codes
|
||||||
|
# to the pattern layout. Color schemes should only be used with appenders
|
||||||
|
# that write to STDOUT or STDERR; inserting terminal color codes into a file
|
||||||
|
# is generally considered bad form.
|
||||||
|
Logging.color_scheme("bright",
|
||||||
|
levels: {
|
||||||
|
info: :green,
|
||||||
|
warn: :yellow,
|
||||||
|
error: :red,
|
||||||
|
fatal: %i(white on_red)
|
||||||
|
},
|
||||||
|
date: :blue,
|
||||||
|
logger: :cyan,
|
||||||
|
message: :magenta
|
||||||
|
)
|
||||||
|
|
||||||
|
# Configure an appender that will write log events to STDOUT. A colorized
|
||||||
|
# pattern layout is used to format the log events into strings before
|
||||||
|
# writing.
|
||||||
|
Logging.appenders.stdout("stdout",
|
||||||
|
auto_flushing: true,
|
||||||
|
layout: Logging.layouts.pattern(
|
||||||
|
pattern: "[%d] %-5l %c : %m\n",
|
||||||
|
color_scheme: "bright"
|
||||||
|
)
|
||||||
|
) if config.log_to.include? "stdout"
|
||||||
|
|
||||||
|
# Configure an appender that will write log events to a file. The file will
|
||||||
|
# be rolled on a daily basis, and the past 7 rolled files will be kept.
|
||||||
|
# Older files will be deleted. The default pattern layout is used when
|
||||||
|
# formatting log events into strings.
|
||||||
|
Logging.appenders.rolling_file("file",
|
||||||
|
filename: config.paths["log"].first,
|
||||||
|
keep: 7,
|
||||||
|
age: "daily",
|
||||||
|
truncate: false,
|
||||||
|
auto_flushing: true,
|
||||||
|
layout: layout
|
||||||
|
) if config.log_to.include? "file"
|
||||||
|
|
||||||
|
# Setup the root logger with the Rails log level and the desired set of
|
||||||
|
# appenders. The list of appenders to use should be set in the environment
|
||||||
|
# specific configuration file.
|
||||||
|
#
|
||||||
|
# For example, in a production application you would not want to log to
|
||||||
|
# STDOUT, but you would want to send an email for "error" and "fatal"
|
||||||
|
# messages:
|
||||||
|
#
|
||||||
|
# => config/environments/production.rb
|
||||||
|
#
|
||||||
|
# config.log_to = %w[file email]
|
||||||
|
#
|
||||||
|
# In development you would want to log to STDOUT and possibly to a file:
|
||||||
|
#
|
||||||
|
# => config/environments/development.rb
|
||||||
|
#
|
||||||
|
# config.log_to = %w[stdout file]
|
||||||
|
#
|
||||||
|
Logging.logger.root.level = config.log_level
|
||||||
|
Logging.logger.root.appenders = config.log_to unless config.log_to.empty?
|
||||||
|
|
||||||
|
# Under Phusion Passenger smart spawning, we need to reopen all IO streams
|
||||||
|
# after workers have forked.
|
||||||
|
#
|
||||||
|
# The rolling file appender uses shared file locks to ensure that only one
|
||||||
|
# process will roll the log file. Each process writing to the file must have
|
||||||
|
# its own open file descriptor for `flock` to function properly. Reopening
|
||||||
|
# the file descriptors after forking ensures that each worker has a unique
|
||||||
|
# file descriptor.
|
||||||
|
if defined? PhusionPassenger
|
||||||
|
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
||||||
|
Logging.reopen if forked
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -26,6 +26,8 @@ before_fork do |_server, _worker|
|
||||||
end
|
end
|
||||||
|
|
||||||
after_fork do |_server, _worker|
|
after_fork do |_server, _worker|
|
||||||
|
Logging.reopen # reopen logfiles to obtain a new file descriptor
|
||||||
|
|
||||||
ActiveRecord::Base.establish_connection # preloading app in master, so reconnect to DB
|
ActiveRecord::Base.establish_connection # preloading app in master, so reconnect to DB
|
||||||
|
|
||||||
# We don't generate uuids in the frontend, but let's be on the safe side
|
# We don't generate uuids in the frontend, but let's be on the safe side
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue