• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a bit of advice

 
joew weakers
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there. Not too sure if I should be posting this query here but it is so general that I wasn't sure where to post it. Basically what I want to do is to record every user interaction that a particular user has with a map representation in some sort of log file. My program renders maps to the screen and the user can switch features on and off and zoom in and out of various regions in the map. The program is set up to catch mouse events so that if the user clicks on, selects or drags on any part of the map, using the mouse, this can then be recorded. So simply is there any particular approach to recording these mouse events in logs or some other format that would best suit the requirements of my system. I am merely looking for advice on what is the best method to record user interaction wit hmy map system. Thanks a lot ... Joe
P.S. anybody who uses the system must be a valid user and therefore needs to log into the system. Therefore any interaction can be associated with one particular user.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As of 1.4 Java has a Logger class that can write log entries. Actually it's a whole framework, very flexible and equally complex at times. There is some controversy about whether it was well designed, or maybe other loggers are better for big applications.
If you are into Do The Simplest Thing That Can Possibly Work, you might write your own Logger class with a static log(message) method and code it to write the message anywhere you want. I wrote my own (before 1.4 or Log4J) that publishes messages to any number of subscribers and the subscribers write to stdout, disk, an in-memory buffer, etc.
There are some attempts at standards around log entry formats, hoping to make log analyzers more interoperable. I think the 1.4 logger doc talks about them.
Hope that helps!
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and if you want to jump waaaaay into the deep end, look at Aspect Oriented Programming. It offers a way to add logging to code without touching the code. Sound magical? It is!
 
joew weakers
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers Stan. Tahnks a lot for the advice. Sounds like a good call!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic