Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336938

Summary: Error Log view doesn't update reliably
Product: [Eclipse Project] Equinox Reporter: Markus Keller <markus.kell.r>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen, tjwatson
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch none

Description Markus Keller CLA 2011-02-11 09:03:04 EST
I20110208-0800

- start Eclipse with this command line, so that you can see the live log:

eclipsec.exe -data wspc -consolelog -console -showlocation -vmargs -Xmx256M

- open the Error Log view
- follow the steps from bug 336936

=> NPE is logged but doesn't show up in Error Log view

When I apply more changes in the editor and then save, some messages appear in the view, but the first NPE doesn't show up unless I click "Restore Log" or change the "Group By" setting.
Comment 1 Markus Keller CLA 2011-02-11 09:04:00 EST
The problem could be that the NPE is logged in a background thread.
Comment 2 Remy Suen CLA 2011-02-11 09:09:59 EST
I've seen this before but cannot reproduce reliably.
Comment 3 Markus Keller CLA 2011-02-11 09:11:06 EST
Could be collateral damage from bug 292135.
Comment 4 Thomas Watson CLA 2011-02-11 17:25:37 EST
I'm not able to reproduce.  I get an error in my log each startup 

!ENTRY org.eclipse.core.net 1 0 2011-02-11 16:20:58.559
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences


Not sure why, but this error shows up in my log view each startup and the NPE from bug 336936 always shows up in the error log if I follow the steps to reproduce the NPE.  Perhaps my environment is not correct because I get primed with the first error log entry each startup.
Comment 5 Thomas Watson CLA 2011-03-21 16:52:03 EDT
I have been able to reproduce.  The issue is that the listeners of extended log service are not sorted.  The listener responsible for writing the eclipse log is being called after the listener for the LogView.  If it is the first log entry being logged then the LogView will read the log from disk before the event has been processed by listener responsible for writing the eclips log has written the log.

The solution is to keep the listeners sorted so we call them in the order they were added.  The eclipse log writer will always be added first.
Comment 6 Thomas Watson CLA 2011-03-21 17:15:44 EDT
Created attachment 191645 [details]
patch

This patch uses the internal class ArrayMap to ensure ordering.  It also could help with performance when iterating over listeners since we don't have to use a heavy weight Map.  But this could slow down add/remove listener if we have large numbers of listeners (something I really hope we don't have).
Comment 7 Thomas Watson CLA 2011-03-21 17:17:20 EDT
Patch released.