private String getTimestamp()

in geode-core/src/main/java/org/apache/geode/internal/logging/LogFileParser.java [141:197]


  private String getTimestamp(final String line) {
    int llen = line.length();
    String result = null;
    if (llen > 10) {
      // first see if the start of the line is a timestamp, as in a thread-dump's stamp
      if (line.charAt(0) == '2' && line.charAt(1) == '0' && line.charAt(4) == '-'
          && line.charAt(7) == '-') {
        return line.substring(0, 19).replace('-', '/');
      }
      // now look for gemfire's log format
      if (line.charAt(0) == '[') {
        if (line.charAt(1) == 'i' && line.charAt(2) == 'n'
            && line.charAt(3) == 'f' ||

            line.charAt(1) == 'f' && line.charAt(2) == 'i'
                && line.charAt(3) == 'n'
            ||

            line.charAt(1) == 'w' && line.charAt(2) == 'a'
                && line.charAt(3) == 'r'
            ||

            line.charAt(1) == 'd' && line.charAt(2) == 'e'
                && line.charAt(3) == 'b'
            ||

            line.charAt(1) == 't' && line.charAt(2) == 'r'
                && line.charAt(3) == 'a'
            ||

            line.charAt(1) == 's' && line.charAt(2) == 'e'
                && line.charAt(3) == 'v'
            ||

            line.charAt(1) == 'c' && line.charAt(2) == 'o'
                && line.charAt(3) == 'n'
            ||

            line.charAt(1) == 'e' && line.charAt(2) == 'r'
                && line.charAt(3) == 'r'
            ||

            line.charAt(1) == 's' && line.charAt(2) == 'e' && line.charAt(3) == 'c'
                && line.charAt(4) == 'u' && line.charAt(5) == 'r') {
          int sidx = 4;
          while (sidx < llen && line.charAt(sidx) != ' ') {
            sidx++;
          }
          int endIdx = sidx + 24;
          if (endIdx < llen) {
            result = line.substring(sidx + 1, endIdx + 1);
          }
        }
      }
    }
    return result;
  }