Authored by chunhua.zhang

add

... ... @@ -18,8 +18,11 @@ public final class ReportCons {
logger.info("{}", toFormatString(model));
}
private static String getHiveTimestamp(){
final String PATTERN = "yyyy-MM-dd HH:mm:ss.SSS";
return new SimpleDateFormat(PATTERN).format(new Date());
}
private static String toFormatString(ClientReportErrorModel model) {
String str = model.getTime() + '|'
... ... @@ -47,47 +50,17 @@ public final class ReportCons {
+ model.getSt() + '|'
+ model.getExceptionType() + '|'
+ model.getUdid() + '|'
+ System.currentTimeMillis() + '\n';
+ System.currentTimeMillis() + '|'
+ getHiveTimestamp() +
'\n';
return str;
}
private static String toFormatString2(ClientReportErrorModel model) {
StringBuilder builder = new StringBuilder();
builder = Joiner.on("|").useForNull("").appendTo(builder,
model.getTime(),
model.getcId(),
model.getBody(),
model.getClient(),
model.getEc(),
model.getEi(),
model.getEt(),
model.getId(),
model.getMethod(),
model.getResponse(),
model.getsId(),
model.getTs(),
model.getUid(),
model.getTec(),
model.getCts(),
model.getMethodevent(),
model.getIndex(),
model.getOsv(),
model.getDm(),
model.getAv(),
model.getNet(),
model.getCa(),
model.getSt(),
model.getExceptionType(),
model.getUdid(),
System.currentTimeMillis());
builder.append(String.valueOf("\n"));
return builder.toString();
}
public static void main(String[] args) {
ClientReportErrorModel model = new ClientReportErrorModel();
model.setUid("uid");
System.out.println(ReportCons.toFormatString(model));
System.out.println(ReportCons.toFormatString2(model));
}
}
... ...