Merge branch 'master' of git.yoho.cn:ops/client-error-report
Showing
1 changed file
with
45 additions
and
2 deletions
1 | package com.yoho.opsmanager.other.clientReport; | 1 | package com.yoho.opsmanager.other.clientReport; |
2 | 2 | ||
3 | +import com.google.common.base.Joiner; | ||
3 | import com.yoho.opsmanager.common.model.ClientReport.ClientReportErrorModel; | 4 | import com.yoho.opsmanager.common.model.ClientReport.ClientReportErrorModel; |
4 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
5 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
@@ -21,7 +22,7 @@ public final class ReportCons { | @@ -21,7 +22,7 @@ public final class ReportCons { | ||
21 | 22 | ||
22 | 23 | ||
23 | private static String toFormatString(ClientReportErrorModel model) { | 24 | private static String toFormatString(ClientReportErrorModel model) { |
24 | - return model.getTime() + '|' | 25 | + String str = model.getTime() + '|' |
25 | + model.getcId() + '|' | 26 | + model.getcId() + '|' |
26 | + model.getBody() + '|' | 27 | + model.getBody() + '|' |
27 | + model.getClient() + '|' | 28 | + model.getClient() + '|' |
@@ -45,6 +46,48 @@ public final class ReportCons { | @@ -45,6 +46,48 @@ public final class ReportCons { | ||
45 | + model.getCa() + '|' | 46 | + model.getCa() + '|' |
46 | + model.getSt() + '|' | 47 | + model.getSt() + '|' |
47 | + model.getExceptionType() + '|' | 48 | + model.getExceptionType() + '|' |
48 | - + model.getUdid() + '\n'; | 49 | + + model.getUdid() + '|' |
50 | + + System.currentTimeMillis() + '\n'; | ||
51 | + return str; | ||
52 | + } | ||
53 | + | ||
54 | + private static String toFormatString2(ClientReportErrorModel model) { | ||
55 | + StringBuilder builder = new StringBuilder(); | ||
56 | + builder = Joiner.on("|").useForNull("").appendTo(builder, | ||
57 | + model.getTime(), | ||
58 | + model.getcId(), | ||
59 | + model.getBody(), | ||
60 | + model.getClient(), | ||
61 | + model.getEc(), | ||
62 | + model.getEi(), | ||
63 | + model.getEt(), | ||
64 | + model.getId(), | ||
65 | + model.getMethod(), | ||
66 | + model.getResponse(), | ||
67 | + model.getsId(), | ||
68 | + model.getTs(), | ||
69 | + model.getUid(), | ||
70 | + model.getTec(), | ||
71 | + model.getCts(), | ||
72 | + model.getMethodevent(), | ||
73 | + model.getIndex(), | ||
74 | + model.getOsv(), | ||
75 | + model.getDm(), | ||
76 | + model.getAv(), | ||
77 | + model.getNet(), | ||
78 | + model.getCa(), | ||
79 | + model.getSt(), | ||
80 | + model.getExceptionType(), | ||
81 | + model.getUdid(), | ||
82 | + System.currentTimeMillis()); | ||
83 | + builder.append(String.valueOf("\n")); | ||
84 | + return builder.toString(); | ||
85 | + } | ||
86 | + | ||
87 | + public static void main(String[] args) { | ||
88 | + ClientReportErrorModel model = new ClientReportErrorModel(); | ||
89 | + model.setUid("uid"); | ||
90 | + System.out.println(ReportCons.toFormatString(model)); | ||
91 | + System.out.println(ReportCons.toFormatString2(model)); | ||
49 | } | 92 | } |
50 | } | 93 | } |
-
Please register or login to post a comment