Merge branch 'stable' into develop
This commit is contained in:
commit
aae11e07ae
4 changed files with 29 additions and 7 deletions
|
|
@ -31,6 +31,7 @@ Ruby 2.0 is no longer officially supported.
|
|||
* Refactored the Logger to add basic logrotating and more useful timestamps [#5975](https://github.com/diaspora/diaspora/pull/5975)
|
||||
* Gracefully handle mailer failures if a like is already deleted again [#5983](https://github.com/diaspora/diaspora/pull/5983)
|
||||
* Ensure posts have an author [#5986](https://github.com/diaspora/diaspora/pull/5986)
|
||||
* Improve the logging messages of Sidekiq messages [#5988](https://github.com/diaspora/diaspora/pull/5988)
|
||||
|
||||
## Bug fixes
|
||||
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ module Workers
|
|||
sidekiq_options backtrace: (bt = AppConfig.environment.sidekiq.backtrace.get) && bt.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
|
||||
def suppress_annoying_errors(&block)
|
||||
yield
|
||||
|
|
@ -40,5 +36,11 @@ module Workers
|
|||
"duplicate key in table 'posts'"
|
||||
).any? {|index| e.message.include? index }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def logger
|
||||
@logger ||= ::Logging::Logger[self]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,7 +28,25 @@ Sidekiq.configure_server do |config|
|
|||
# Make sure each Sidekiq process has its own sequence of UUIDs
|
||||
UUID.generator.next_sequence
|
||||
|
||||
Sidekiq.logger = Logging.logger[Sidekiq]
|
||||
# wrap the logger to add the sidekiq job context to the log
|
||||
class SidekiqLogger < SimpleDelegator
|
||||
SPACE = " "
|
||||
|
||||
# only info is used with context
|
||||
def info(data=nil)
|
||||
return false if Logger::Severity::INFO < level
|
||||
data = yield if data.nil? && block_given?
|
||||
__getobj__.info("#{context}#{data}")
|
||||
end
|
||||
|
||||
# from sidekiq/logging.rb
|
||||
def context
|
||||
c = Thread.current[:sidekiq_context]
|
||||
"#{c.join(SPACE)}: " if c && c.any?
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq::Logging.logger = SidekiqLogger.new(Logging.logger[Sidekiq])
|
||||
end
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ Logging::Rails.configure do |config|
|
|||
Logging.format_as :inspect
|
||||
|
||||
# The default layout used by the appenders.
|
||||
layout = Logging.layouts.pattern(pattern: "[%d] %-5l %c : %m\n")
|
||||
pattern = "[%d] %-5l PID-%p TID-%t %c: %m\n"
|
||||
layout = Logging.layouts.pattern(pattern: pattern)
|
||||
|
||||
# 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
|
||||
|
|
@ -30,7 +31,7 @@ Logging::Rails.configure do |config|
|
|||
Logging.appenders.stdout("stdout",
|
||||
auto_flushing: true,
|
||||
layout: Logging.layouts.pattern(
|
||||
pattern: "[%d] %-5l %c : %m\n",
|
||||
pattern: pattern,
|
||||
color_scheme: "bright"
|
||||
)
|
||||
) if config.log_to.include? "stdout"
|
||||
|
|
|
|||
Loading…
Reference in a new issue