This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Jan 29, 2003
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!
Joined: Aug 21, 2003
Cheers Stan. Tahnks a lot for the advice. Sounds like a good call!