Get lager event handlers from gen_event

The existing mechanism for getting lager_event's handlers incorrectly
uses the data structure returned by application:get_env, which is a
configuration defined in sys.config. The actual lager_event handler
list is obtained directly from gen_event.

COUCHDB-2970
diff --git a/src/couch_log_lager.erl b/src/couch_log_lager.erl
index 504d359..56d4fcd 100644
--- a/src/couch_log_lager.erl
+++ b/src/couch_log_lager.erl
@@ -64,9 +64,9 @@
 
 -spec set_level(atom()) -> ok.
 set_level(Level) ->
-    {ok, Handlers} = application:get_env(lager, handlers),
-    lists:foreach(fun({Handler, _}) ->
-        lager:set_loglevel(Handler, Level)
+    Handlers = gen_event:which_handlers(lager_event),
+    lists:foreach(fun(Handler) ->
+        ok = lager:set_loglevel(Handler, Level)
     end, Handlers).