     `(log ~level nil ~message))
   ([level throwable message]
     `(log ~*ns* ~level ~throwable ~message))
-  ([log-ns level throwable message]
-    `(log *logger-factory* ~log-ns ~level ~throwable ~message))
-  ([logger-factory log-ns level throwable message]
-    `(let [logger# (impl-get-logger ~logger-factory ~log-ns)]
+  ([logger-ns level throwable message]
+    `(log *logger-factory* ~logger-ns ~level ~throwable ~message))
+  ([logger-factory logger-ns level throwable message]
+    `(let [logger# (impl-get-logger ~logger-factory ~logger-ns)]
        (if (impl-enabled? logger# ~level)
          (log* logger# ~level ~throwable ~message)))))
 

         (reify LoggerFactory
           (impl-name [_#]
             "org.apache.log4j")
           (impl-get-logger [_# log-ns#]
             (org.apache.log4j.Logger/getLogger ^String (str log-ns#))))))
    (catch Exception e nil)))

(defn java-util-logging

      monitor (Object.)] ; sync monitor for calling setOut/setErr
  (defn log-capture!
    "Captures System.out and System.err, piping all writes of those streams to
    the log. If unspecified, levels default to :info and :error, respectively.
    The specified logger-ns value will be used to namespace all log entries.

    Note: use with-logs to redirect output of *out* or *err*.

    Warning: if the logging implementation is configured to output to System.out
    (as is the default with java.util.logging) then using this function will
    result in StackOverflowException when writing to the log."
    ; Implementation Notes:
    ; - only set orig when nil to preserve original out/err
    ; - no enabled? check before making streams since that may change later
    ([logger-ns]
      (log-capture! logger-ns :info :error))
    ([logger-ns out-level err-level]
      (locking monitor
        (compare-and-set! orig nil [System/out System/err])
        (System/setOut  (log-stream out-level logger-ns))
        (System/setErr (log-stream err-level logger-ns)))))
  (defn log-uncapture!
    "Restores System.out and System.err to their original values."
    []
