LOG.warn("DebugPhaseListener disabled, because the project stage is 'production'.");
return;
}
if (LOG.isInfoEnabled()) {
final PhaseId phaseId = phaseEvent.getPhaseId();
if (LOG.isDebugEnabled() || phaseId.getOrdinal() == 1) {
final ExternalContext externalContext = facesContext.getExternalContext();
if (LOG.isTraceEnabled() && PhaseId.RESTORE_VIEW == phaseId) {
// this is before restoreView
final Object request = externalContext.getRequest();
if (request instanceof HttpServletRequest) {
HttpServletRequest servletRequest = (HttpServletRequest) request;
LOG.trace("RequestURI = " + servletRequest.getRequestURI());
}
final Map headerMap = externalContext.getRequestHeaderMap();
for (Object key : headerMap.keySet()) {
LOG.trace("Header : '" + key + "' = '" + headerMap.get(key) + "'");
}
final Map parameterMap = externalContext.getRequestParameterMap();
for (Object key : parameterMap.keySet()) {
LOG.trace("Param : '" + key + "' = '" + parameterMap.get(key) + "'");
}
}
final Long start = System.currentTimeMillis();
final Map<String, Object> map = externalContext.getRequestMap();
map.put(KEY + phaseId.getOrdinal() + "S", start);
if (LOG.isDebugEnabled()) {
Long end = null;
int ordinal = phaseId.getOrdinal();
while (end == null && ordinal > 0) {
end = (Long) map.get(KEY + --ordinal + "E");
}
if (end != null) {
LOG.debug("Time between phases " + ordinal + " and " + phaseId.getOrdinal() + ": "
+ (start - end) + " milliseconds");
}
}
if (LOG.isTraceEnabled()) {
LOG.trace("Before Phase :" + phaseId + " Time=" + start);