parent
7c0e50c2c2
commit
b491ecac31
4 changed files with 29 additions and 7 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
* Refactored the Logger to add basic logrotating and more useful timestamps [#5975](https://github.com/diaspora/diaspora/pull/5975)
|
* 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)
|
* 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)
|
* 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
|
## 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)
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,6 @@ 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
|
||||||
|
|
@ -40,5 +36,11 @@ module Workers
|
||||||
"duplicate key in table 'posts'"
|
"duplicate key in table 'posts'"
|
||||||
).any? {|index| e.message.include? index }
|
).any? {|index| e.message.include? index }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def logger
|
||||||
|
@logger ||= ::Logging::Logger[self]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,25 @@ 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]
|
# 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
|
end
|
||||||
|
|
||||||
Sidekiq.configure_client do |config|
|
Sidekiq.configure_client do |config|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ Logging::Rails.configure do |config|
|
||||||
Logging.format_as :inspect
|
Logging.format_as :inspect
|
||||||
|
|
||||||
# The default layout used by the appenders.
|
# 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
|
# 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
|
# 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",
|
Logging.appenders.stdout("stdout",
|
||||||
auto_flushing: true,
|
auto_flushing: true,
|
||||||
layout: Logging.layouts.pattern(
|
layout: Logging.layouts.pattern(
|
||||||
pattern: "[%d] %-5l %c : %m\n",
|
pattern: pattern,
|
||||||
color_scheme: "bright"
|
color_scheme: "bright"
|
||||||
)
|
)
|
||||||
) if config.log_to.include? "stdout"
|
) if config.log_to.include? "stdout"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue