|
@ -1,17 +1,19 @@ |
|
|
module SemanticLogger |
|
|
module SemanticLogger |
|
|
# Manage a collection of appenders. |
|
|
|
|
|
class Appenders < Concurrent::Array |
|
|
class Appenders < Concurrent::Array |
|
|
def close |
|
|
def close |
|
|
closed_appenders = [] |
|
|
closed_appenders = [] |
|
|
each do |appender| |
|
|
each do |appender| |
|
|
logger.trace "Closing appender: #{appender.name}" |
|
|
logger.trace "Closing appender: #{appender.name}" |
|
|
closed_appenders << appender |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# PVINCENT's change |
|
|
|
|
|
closed_appenders << appender # closed_ missing!!!! |
|
|
|
|
|
# END OF change |
|
|
|
|
|
|
|
|
appender.flush |
|
|
appender.flush |
|
|
appender.close |
|
|
appender.close |
|
|
rescue Exception => e |
|
|
rescue Exception => e |
|
|
logger.error "Failed to close appender: #{appender.name}", e |
|
|
logger.error "Failed to close appender: #{appender.name}", e |
|
|
end |
|
|
end |
|
|
# Delete appenders outside the #each above which prevents changes during iteration. |
|
|
|
|
|
closed_appenders.each { |appender| delete(appender) } |
|
|
closed_appenders.each { |appender| delete(appender) } |
|
|
logger.trace 'All appenders closed and removed from appender list' |
|
|
logger.trace 'All appenders closed and removed from appender list' |
|
|
end |
|
|
end |
|
|