Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Refactoring the Appenders shutdown #20

Merged
merged 1 commit into from

2 participants

@martinos

Here are the changes that I have made to the shutting down of the logger. Hope that this will do it for you.

@martinos

As you can see I had to create a ::Logging::finalize method since define_fininalizer need a proc with one parameter and I did't want to change the shutdown method.

@TwP
Owner
TwP commented

Just throwing a *args on the shutdown method would be fine. I'll merge your changes and then tweak to taste :wink2: Thank you for your help on this one!

@TwP TwP merged commit 2384872 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 3, 2012
  1. @martinos

    Refactoring the Appenders shutdown

    martinos authored
    Removing gemspec
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/logging.rb
View
8 lib/logging.rb
@@ -497,6 +497,10 @@ def shutdown
log_internal {'shutdown called - closing all appenders'}
::Logging::Appenders.each {|appender| appender.close}
end
+
+ def finalize(id)
+ shutdown
+ end
# Reset the logging framework to it's uninitialized state
def reset
@@ -538,7 +542,7 @@ def reset
# This is needed for closing IO streams and connections to the syslog server
# or e-mail servers, etc.
#
-at_exit { Logging.shutdown }
-
end # unless defined?
+ObjectSpace.define_finalizer(self, ::Logging::method(:finalize))
+
Something went wrong with that request. Please try again.