}
-
/**
* Try/Catch méthode. Execute le code passé dans la closure en captant les
* Exceptions.
return resultat
}
- /*
- * Logging des paramètres en cas d'exception
- * Spécial Mantis [PARAM]
- */
-
- protected void logErreurParams(Exception e) {
- log.error message(code: 'eliot.textes.log.erreur.params', args: [actionName]), e
- try {
- logHttpError(params, request)
- }
- catch (Exception e1) {
- log.error "Erreur sur le log", e1
- }
-
- }
-
- private void logHttpError(Map params, def obj) {
-
- Map resultat = [:]
-
- String rapport = "\n== Erreur sur Http - rapport ==\n\nDonnées invalides ou absentes : $params\n\n"
-
- if (obj instanceof HttpServletRequest) {
-
- HttpServletRequest httpServletRequest = (HttpServletRequest) obj
-
- resultat.authType = httpServletRequest.authType
- resultat.contextPath = httpServletRequest.contextPath
- resultat.requestedSessionId = httpServletRequest.requestedSessionId
- resultat.requestedSessionIdValid = httpServletRequest.requestedSessionIdValid
- resultat.servletPath = httpServletRequest.servletPath
- resultat.characterEncoding = httpServletRequest.characterEncoding
- resultat.contentType = httpServletRequest.contentType
- resultat.contentLength = httpServletRequest.contentLength
- resultat.localAddr = httpServletRequest.localAddr
- resultat.localName = httpServletRequest.localName
- resultat.serverName = httpServletRequest.serverName
- resultat.serverPort = httpServletRequest.serverPort
- resultat.remoteUser = httpServletRequest.remoteUser
- resultat.remoteAddr = httpServletRequest.remoteAddr
- resultat.remoteHost = httpServletRequest.remoteHost
- resultat.remotePort = httpServletRequest.remotePort
- resultat.pathInfo = httpServletRequest.pathInfo
-
-// HttpSession httpSession = httpServletRequest.getSession()
-// httpSession.attributeNames.eachWithIndex { k, index ->
-// resultat."session($index)" = "${k}=${httpSession.getValue(k)}"
-// }
-
- httpServletRequest.headerNames.eachWithIndex {String name, Integer index ->
-
- String valeur = httpServletRequest.getHeader(name)
-
- resultat."Header($index)" = "$name = $valeur"
- }
-
-
- resultat.each {
- rapport = rapport + entryToString(it) + "\n"
- }
-
- log.error rapport
-
- }
-
- else {
- log.error obj.getClass().getCanonicalName()
- }
-
- }
-
-/*
-* Try catch avec logging des paramètres en cas d'exception
-* Spécial Mantis [PARAM]
-*/
-
- protected void tryCatchLogErreurParams(Closure closure) {
- try {
- closure(params)
- } catch (Exception e) {
- logErreurParams(e)
- }
- }
-
/**
* Indique si on peut modifier le contenu du cahier de textes
* auquel appartient uneActivite
return peutModifierContenuCdt
}
- private static final int COL_1 = 30
-
- private String entryToString(def entry) {
- String key = entry.key
- String value = entry.value
- if (value == null) {
- value = "<NULL>"
- }
- String resultat = key
-
- int n1 = COL_1 - key.length()
- if (n1 < 1) {
- n1 = 1
+ protected void tryCatchLogErreurParams(Closure closure) {
+ try {
+ closure(params)
+ } catch (Exception e) {
+ logErreurParams(e)
}
+ }
- resultat += String.format("%${n1}s", "")
- resultat += "|" + value
-
- return resultat
+ protected void logErreurParams(Exception e) {
+ log.war "Erreur de paramétrage du time-out tomcat."
}
+
}