Created
October 6, 2016 21:58
-
-
Save micha/d536bd42e686819f73457c409c971127 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gymir.main | |
(:require | |
[gymir | |
[worker :refer [start stop]] | |
[util :refer [with-stderr print-trace]]])) | |
(Thread/setDefaultUncaughtExceptionHandler | |
(reify Thread$UncaughtExceptionHandler | |
(uncaughtException [_ thread ex] | |
(with-stderr (prn :UNCAUGHT {:thread (.getName thread)})) | |
(print-trace ex)))) | |
;; various logging things | |
(System/setProperty | |
"java.util.logging.SimpleFormatter.format" "%4$s: %5$s%6$s%n") | |
(def console-log | |
(-> (java.util.logging.Logger/getLogger "") | |
(.getHandlers) | |
(first))) | |
(.. (java.util.logging.Logger/getLogger "gymir.worker") | |
(setLevel java.util.logging.Level/ALL)) | |
(.. (java.util.logging.Logger/getLogger "gymir.repl") | |
(setLevel java.util.logging.Level/ALL)) | |
(.. (java.util.logging.Logger/getLogger "com.amazonaws.http") | |
(setLevel java.util.logging.Level/WARNING)) | |
(.. (java.util.logging.Logger/getLogger "com.amazonaws.auth") | |
(setLevel java.util.logging.Level/SEVERE)) | |
(.setLevel console-log java.util.logging.Level/ALL) | |
(.. (Runtime/getRuntime) | |
(addShutdownHook (Thread. #(do (stop) (.close console-log))))) | |
(defn -main | |
"Start gymir -- application entrypoint." | |
[& args] | |
(start)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment