// if ProjectStage is Development, install the DebugPhaseListener
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext.isProjectStage(ProjectStage.Development) &&
MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isDebugPhaseListenerEnabled())
{
lifecycle.addPhaseListener(new DebugPhaseListener());
}
}
}