@Override
 public void beforePhase(PhaseEvent arg0) {
   // TODO Auto-generated method stub
   System.out.println("Before Phase:" + arg0.getSource());
   System.out.println("Before Phase:" + arg0.getFacesContext());
   System.out.println("Before Phase:" + arg0.getClass());
   System.out.println("Before Phase:" + arg0.getPhaseId());
 }
  private static void onEvent(PhaseEvent event, String prefix) {
    PhaseId phase = event.getPhaseId();
    Object source = event.getSource();

    DebugMessage message = new DebugMessage();
    message.event = prefix + " " + phase;
    message.source = getObjectString(source);
    message.component = null;
    message.details = null;
    message.type = TYPE_LIFECYCLE;

    messages.add(message);
  }