Results 1 to 3 of 3
Examples of Logging in a complex GUI program
Does anyone know of any good examples of best practices when using Logging in a fairly complex, MVC Swing GUI program?
Heck, it doesn't even have to be Swing or GUI, but any complex multi-class program will do. I'm trying to upgrade a utility program of mine by implement Logging for the first time. I've gone through the Oracle tutorial on logging, such as it is, but I'd feel much more comfortable if I could see how folks use logging in a bigger program and on a larger scale. Thanks! /Pete
- 10-30-2011, 03:10 AM #2Moderator
- Join Date
- Jul 2010
- Rep Power
Re: Examples of Logging in a complex GUI program
A great question, and if you find any I would be interested to know, as I don't know of any tutorials like this and have only followed my own rules and those of a few colleagues. I can provide my two cents - take them with a grain of salt: whether or not they are best practices I cannot guarantee. For me, the biggest feature of logging is how one can make use of levels. I always pass exceptions to the error level of a logger as opposed to the printStackTrace method. Where I would typically place an assertion I will log in the warning level. Typically will log to the info level to monitor user interaction rather than program flow - one info log per action for example - mainly to track the workflow of the user as opposed to the workflow of the software. Debug levels I reserve for tracking program flow - the workflow of the software, such as profiling and more minute processes of the UI or an algorithm. Both trace and to a lesser extent debug I use liberally during the development - and am flexible about where I place these and what I log - similar to how one might use System.out.println (I will often remove many of these as they end up cluttering future debugging processes in another part of the program). I deploy at the info level, and will often include a info log in the main method logging the version, deploy date, etc...What information you log is another beast entirely. I will typically log information related to the calling method - for example with an ActionListener, I'll log something like the ActionCommand and source (one can make use of the toString method here for more informative logs).
Last edited by doWhile; 10-30-2011 at 03:13 AM.
- By manji51 in forum AWT / SwingReplies: 7Last Post: 07-08-2011, 07:20 PM
- By F-Man in forum SWT / JFaceReplies: 0Last Post: 10-16-2009, 02:35 AM
- By Java Tip in forum SWT TipsReplies: 0Last Post: 07-02-2008, 07:54 PM