code: private static void traceView(String additionalMsg, UIViewRoot viewRoot)
      {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          PrintStream ps = new PrintStream(baos);
          if (additionalMsg != null)
          {
              ps.println(additionalMsg);
          }
          ps.println("========================================");
          printView(viewRoot, ps);
          ps.println("========================================");
          ps.close();
          log.finest(baos.toString());
      }
docs: Be careful, when using this version of traceView: Some component properties (e.g. getRenderer) assume, that there
  is a valid viewRoot set in the FacesContext!
  
  @param additionalMsg
  @param viewRoot