|
61 | 61 | []
|
62 | 62 | (when (class-found? "org.slf4j.Logger")
|
63 | 63 | (eval
|
64 |
| - `(do |
| 64 | + `(let [; Same as is done inside LoggerFactory/getLogger(String). |
| 65 | + factory# (org.slf4j.LoggerFactory/getILoggerFactory)] |
65 | 66 | (extend org.slf4j.Logger
|
66 | 67 | Logger
|
67 | 68 | {:enabled?
|
|
98 | 99 | (name [_#]
|
99 | 100 | "org.slf4j")
|
100 | 101 | (get-logger [_# logger-ns#]
|
101 |
| - (org.slf4j.LoggerFactory/getLogger ^String (str logger-ns#)))))))) |
| 102 | + (.getLogger factory# ^String (str logger-ns#)))))))) |
102 | 103 |
|
103 | 104 | (defn cl-factory
|
104 | 105 | "Returns a Commons Logging-based implementation of the LoggerFactory protocol, or
|
105 | 106 | nil if not available."
|
106 | 107 | []
|
107 | 108 | (when (class-found? "org.apache.commons.logging.Log")
|
108 | 109 | (eval
|
109 |
| - `(do |
| 110 | + `(let [; Same as is done inside LogFactory/getLog(String). |
| 111 | + factory# (org.apache.commons.logging.LogFactory/getFactory)] |
110 | 112 | (extend org.apache.commons.logging.Log
|
111 | 113 | Logger
|
112 | 114 | {:enabled?
|
|
142 | 144 | (name [_#]
|
143 | 145 | "org.apache.commons.logging")
|
144 | 146 | (get-logger [_# logger-ns#]
|
145 |
| - (org.apache.commons.logging.LogFactory/getLog (str logger-ns#)))))))) |
| 147 | + (.getInstance factory# (str logger-ns#)))))))) |
146 | 148 |
|
147 | 149 | (defn log4j-factory
|
148 | 150 | "Returns a Log4j-based implementation of the LoggerFactory protocol, or nil if
|
|
179 | 181 | []
|
180 | 182 | (when (class-found? "org.apache.logging.log4j.Logger")
|
181 | 183 | (eval
|
182 |
| - `(let [levels# {:trace org.apache.logging.log4j.Level/TRACE |
| 184 | + `(let [; Same as is done inside LogManager/getLogger(String). |
| 185 | + context# (org.apache.logging.log4j.LogManager/getContext false) |
| 186 | + levels# {:trace org.apache.logging.log4j.Level/TRACE |
183 | 187 | :debug org.apache.logging.log4j.Level/DEBUG
|
184 | 188 | :info org.apache.logging.log4j.Level/INFO
|
185 | 189 | :warn org.apache.logging.log4j.Level/WARN
|
|
206 | 210 | (name [_#]
|
207 | 211 | "org.apache.logging.log4j")
|
208 | 212 | (get-logger [_# logger-ns#]
|
209 |
| - (org.apache.logging.log4j.LogManager/getLogger ^String (str logger-ns#)))))))) |
| 213 | + (.getLogger context# ^String (str logger-ns#)))))))) |
210 | 214 |
|
211 | 215 | (defn jul-factory
|
212 | 216 | "Returns a java.util.logging-based implementation of the LoggerFactory protocol,
|
|
0 commit comments