diff -r 9a81a11be70e -r e71ae69c68c0 src/main/kotlin/de/uapcore/lightpit/AbstractServlet.kt --- a/src/main/kotlin/de/uapcore/lightpit/AbstractServlet.kt Sun Dec 12 18:16:46 2021 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/AbstractServlet.kt Wed Dec 15 19:56:05 2021 +0100 @@ -34,7 +34,9 @@ import javax.servlet.http.HttpServletRequest import javax.servlet.http.HttpServletResponse -abstract class AbstractServlet : LoggingTrait, HttpServlet() { +abstract class AbstractServlet : HttpServlet() { + + protected val logger = MyLogger() /** * Contains the GET request mappings. @@ -68,7 +70,7 @@ Pair(PathPattern(requestPath), ::notFound) } else { if (candidates.size > 1) { - logger().warn("Ambiguous mapping for request path '{}'", requestPath) + logger.warn("Ambiguous mapping for request path '{0}'", requestPath) } candidates.entries.first().toPair() } @@ -82,7 +84,7 @@ ) { val params = mapping.first.obtainPathParameters(sanitizedRequestPath(req)) val method = mapping.second - logger().trace("invoke {}", method) + logger.trace("invoke {0}", method) method(HttpRequest(req, resp, params), dao) } @@ -105,13 +107,13 @@ val sessionLocale = if (availableLanguages.contains(reqLocale)) reqLocale else availableLanguages.first() session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale) resp.locale = sessionLocale - logger().debug( - "Setting language for new session {}: {}", session.id, sessionLocale.displayLanguage + logger.debug( + "Setting language for new session {0}: {1}", session.id, sessionLocale.displayLanguage ) } else { val sessionLocale = session.getAttribute(Constants.SESSION_ATTR_LANGUAGE) as Locale resp.locale = sessionLocale - logger().trace("Continuing session {} with language {}", session.id, sessionLocale) + logger.trace("Continuing session {0} with language {1}", session.id, sessionLocale) } // set some internal request attributes @@ -150,8 +152,8 @@ invokeMapping(findMapping(mappings, req), req, resp, dao) connection.commit() } catch (ex: SQLException) { - logger().warn("Database transaction failed (Code {}): {}", ex.errorCode, ex.message) - logger().debug("Details: ", ex) + logger.warn("Database transaction failed (Code {0}): {1}", ex.errorCode, ex.message) + logger.debug("Details: ", ex) resp.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Unhandled Transaction Error - Code: " + ex.errorCode @@ -160,8 +162,8 @@ } } } catch (ex: SQLException) { - logger().error("Severe Database Exception (Code {}): {}", ex.errorCode, ex.message) - logger().debug("Details: ", ex) + logger.error("Severe Database Exception (Code {0}): {1}", ex.errorCode, ex.message) + logger.debug("Details: ", ex) resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Database Error - Code: " + ex.errorCode) } }