This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 59321 - UI logging module
Summary: UI logging module
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: apireviews
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2005-05-27 12:32 UTC by segapelli
Modified: 2008-12-22 18:12 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
List of all menu items that cannot be logged only by using the class org.openide.awt.Actions (687 bytes, text/plain)
2005-05-27 12:35 UTC, segapelli
Details
Example of how org.openide.awt.Actions could be modified to listen to user clicks on icons and menu items (52.11 KB, text/plain)
2005-05-27 12:37 UTC, segapelli
Details
difference between Actions.java and the one available on CVS. Please note that the first Actions.java file I posted here was based on the 4.1 release version. I will add a version of this file based on the CVS one as well. (1.62 KB, text/plain)
2005-06-02 14:48 UTC, segapelli
Details
org.openide.awt.Actions.java modified for UI logger. Based on CVS version 01.06.2005 (52.20 KB, text/plain)
2005-06-02 14:52 UTC, segapelli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description segapelli 2005-05-27 12:32:42 UTC
The UI logging module is being developped for xdesign-prg. Its purpose is to understand user behavior 
by analyzing log files produced by the module. 

Some of the information is retrieved by using the open API, but here is an example (Actions.java) of 
how NB source code could be modified to log interesting user actions. In the case of 
org.openide.Actions the modified code logs into the UI ErrorManager when the user is clicking an icon 
or a menu item. 

However it does not log some menu items, see attached file NOT_logged_menu_items.txt . It seems 
these items are created somewhere else...
Comment 1 segapelli 2005-05-27 12:35:41 UTC
Created attachment 22334 [details]
List of all menu items that cannot be logged only by using the class org.openide.awt.Actions
Comment 2 segapelli 2005-05-27 12:37:29 UTC
Created attachment 22335 [details]
Example of how org.openide.awt.Actions could be modified to listen to user clicks on icons and menu items
Comment 3 segapelli 2005-05-27 12:42:14 UTC
The modified file belongs to org.openide.awt , not org.openide . Sorry!
Comment 4 Milos Kleint 2005-05-27 12:48:42 UTC
could you provide a diff?

Comment 5 Jaroslav Tulach 2005-05-30 13:39:31 UTC
As Loic is on vacation, I'll ask reviewers for their opinion meanwhile. Do you 
think the usage of  
 
ErrorManager.getDefault().getInstance("org.netbeans.ui.log") 
 
to deliver events to Loic's module is acceptable? 
Comment 6 Jesse Glick 2005-05-31 16:25:43 UTC
Would not suggest capturing UI events this way. Surely they can be captured at
the AWT or Swing level without participation from NetBeans classes, e.g. using
AWTEventListener. I guess a -0 from me: mostly harmless but may be unnecessary and

- clutters NB code

- would require additional patches in the many menu items which do not use
Actions (as already listed)

- is likely to quickly fall out of date as changes are made in the UI
Comment 7 Jaroslav Tulach 2005-06-01 05:05:52 UTC
Originally I thought about AWTListener, but that puts all the hard work on the  
ui-logging module side and cannot be guaranteed to work for more than one  
release, as any change in the UI is going to break the logging module.  
  
While reasonable logging injections split the responsibility between the  
logging module and the application code and can survive even UI refactorings  
as the meaning of an action stays same regardless of the actual UI elements  
that represent it.  
  
I agree that having to insert the same trick into more menu items is not nice. 
But I see no better way. 
 
Btw. this request is only about action invocation, but Loic would like to 
listen to more events like d'n'd and I really think that AWTListener would be 
too fragile for that. Loic, can you attach here what types of events you would 
like to listen to? 
Comment 8 Jesse Glick 2005-06-01 16:00:42 UTC
"that puts all the hard work on the ui-logging module side" - better than
putting hard work on the side of other modules when the UI logging functionality
may or may not have wide usage or a long lifespan anyway. We pay a cost for
added code in random modules.

"cannot be guaranteed to work for more than one release" - neither can the
proposed ErrorManager solution, because it assumes that there will be someone
ensuring that all actions in the IDE consistently log what they are doing in the
recommended way, when this logging is not used by any code in the standard IDE
distribution, and has no visible purpose to most developers. I think that's very
unlikely.

"logging injections split the responsibility between the logging module and the
application code and can survive even UI refactorings as the meaning of an
action stays same regardless of the actual UI elements that represent it" -
often when the UI elements for an action are changed, it is because the meaning
of the action has also changed, so the logger would often need to be changed as
well.

Anyway, logging some particular string when a menu item is invoked does not
sound more helpful than e.g. setting a semistable Component.name for every menu
item - which could also be of benefit to functional tests (more than use of
logging, because you can use it to find a JMenuItem etc. as well as finding
which one was selected).

DnD is probably problematic for AWTListener. On the other hand, modules do not
normally intercept DnD actions - they are mostly handled from a small number of
places (e.g. in explorer), so adding logging to these places is much less
expensive in terms of lines of code.
Comment 9 _ rkubacki 2005-06-01 17:25:43 UTC
Adding logging to important places can be good for this purpose. Especially if
it is used as a supplementary information to data gathered from listening to AWT
events. The toolkit should be primary source of information and logged
information is matched to it. Sometimes it will be lost - presenters for pure
Swing action, buttons in welcome panel, JTree in refactoring preview (this is
not explorer tree). There are just too many places to patch and the logger can
loose the track.

Of course low cost logging would be good with one shared logger. BTW: Should we
start to use JDK logging?
Comment 10 segapelli 2005-06-02 14:48:04 UTC
Created attachment 22453 [details]
difference between Actions.java and the one available on CVS. Please note that the first Actions.java file I posted here was based on the 4.1 release version. I will add a version of this file based on the CVS one as well.
Comment 11 segapelli 2005-06-02 14:52:09 UTC
Created attachment 22454 [details]
org.openide.awt.Actions.java modified for UI logger. Based on CVS version 01.06.2005
Comment 12 segapelli 2005-06-02 15:14:05 UTC
I have been able to log many issues just by using the open api. Here is the list of what could not be 
logged yet:

   * What actions are used, and from where?
      * Main menu
      * Context (right-click)
      * Toolbar
   * How are the actions invoked ? Mouse or keyboard shortcut ?
   * are mnemonics used at all? (Alt+...)
   * Context menu: what object is being manipulated?
   * usage of dnd:
      * In the GUI editor
      * nodes of File view, Project, Navigator
      * windows
      * toolbar items (rearrangement)
   * How does the tab switching occur ? back&forward, hyperlinks, clicking tab, use of file menu ?
   * What projects are used the least/most often 
      * samples
      * empty/existing ant script
      * java/web/J2EE
   * How many files are in one project ? Libraires ? (.jar, folders, ...)
   * Does the user know about the possibility to add classes/methods/... from the contextual menu of 
project window nodes ?
   * Which actions linked to writing code are used ? (reformat, copy-paste, Override Methods, 
abreviations, autocompletion)
   * Are the glifs used ?
   * Property sheet window: isn´t the user always opening properties from the contextual menu ?
   * Debugger: is the user looking into the hidden parts of the stack?
   * J2EE or WebApplication XML editor: which view is used:
      * General
      * Servlets
      * Filters
      * Pages
      * XML
   * How often does the user try to open a file already opened ?

My ErrorManager logs events into a file. Each event is described as concisely as possible; for instance: 
clicking on a menu in my org.openide.awt.Actions.java example generates a message 
"menu"+actionNAME . I also make sure the variable actionNAME is deprived from spaces and 
ampersands. My ErrorManager adds to this message a timestamp; in the end the log file looks like this:

1117199672844 button Copy
1117199676251 button Paste
1117493815313 menu UpdateCenter
1117494514153 menu Exit
Comment 13 Jaroslav Tulach 2005-08-22 11:51:27 UTC
As far as I know Loic does not plan integrations into regular source base any 
time soon. 
 
The UI logger module is in CVS at logger/loggerui