MCPcopy Create free account
hub / github.com/apache/tomcat / log

Method log

java/org/apache/juli/logging/DirectJDKLog.java:154–173  ·  view source on GitHub ↗
(Level level, String msg, Throwable ex)

Source from the content-addressed store, hash-verified

152 }
153
154 private void log(Level level, String msg, Throwable ex) {
155 if (logger.isLoggable(level)) {
156 // Hack (?) to get the stack trace.
157 Throwable dummyException = new Throwable();
158 StackTraceElement[] locations = dummyException.getStackTrace();
159 // Caller will be the third element
160 String cname = "unknown";
161 String method = "unknown";
162 if (locations != null && locations.length > 2) {
163 StackTraceElement caller = locations[2];
164 cname = caller.getClassName();
165 method = caller.getMethodName();
166 }
167 if (ex == null) {
168 logger.logp(level, cname, method, msg);
169 } else {
170 logger.logp(level, cname, method, msg, ex);
171 }
172 }
173 }
174
175 static Log getInstance(String name) {
176 return new DirectJDKLog(name);

Callers 6

debugMethod · 0.95
traceMethod · 0.95
infoMethod · 0.95
warnMethod · 0.95
errorMethod · 0.95
fatalMethod · 0.95

Calls 4

isLoggableMethod · 0.80
getClassNameMethod · 0.65
getStackTraceMethod · 0.45
getMethodNameMethod · 0.45

Tested by

no test coverage detected