2020import java .text .DateFormat ;
2121import java .util .ArrayList ;
2222import java .util .Date ;
23+ import java .util .HashSet ;
2324import java .util .List ;
25+ import java .util .Set ;
2426import java .util .function .Predicate ;
2527
2628import org .eclipse .core .resources .IWorkspaceRoot ;
@@ -61,6 +63,7 @@ public class LogHandler {
6163 private String firstRecordedEntryDateString ;
6264
6365 private List <IStatus > statusCache = new ArrayList <>();
66+ private Set <Integer > knownErrors = new HashSet <>();
6467
6568 /**
6669 * Equivalent to <code>LogHandler(defaultLogFilter)</code>.
@@ -106,6 +109,7 @@ public void setClientConnection(JavaClientConnection clientConnection) {
106109 for (IStatus event : statusCache ) {
107110 processLogMessage (event );
108111 }
112+ statusCache .clear ();
109113
110114 for (LogEntry e : entries ) {
111115 processLogMessage (e );
@@ -139,7 +143,11 @@ private void processLogMessage(LogEntry entry) {
139143 if (entry .getStack () != null ) {
140144 properties .addProperty ("exception" , message );
141145 }
142- connection .telemetryEvent (new TelemetryEvent (JAVA_ERROR_LOG , properties ));
146+ int hashCode = properties .hashCode ();
147+ if (!knownErrors .contains (hashCode )) {
148+ knownErrors .add (hashCode );
149+ connection .telemetryEvent (new TelemetryEvent (JAVA_ERROR_LOG , properties ));
150+ }
143151 }
144152 }
145153 private void processLogMessage (IStatus status ) {
@@ -165,7 +173,11 @@ private void processLogMessage(IStatus status) {
165173 if (status .getException () != null ) {
166174 properties .addProperty ("exception" , message );
167175 }
168- connection .telemetryEvent (new TelemetryEvent (JAVA_ERROR_LOG , properties ));
176+ int hashCode = properties .hashCode ();
177+ if (!knownErrors .contains (hashCode )) {
178+ knownErrors .add (hashCode );
179+ connection .telemetryEvent (new TelemetryEvent (JAVA_ERROR_LOG , properties ));
180+ }
169181 }
170182 }
171183
0 commit comments