Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By doWhile

Thread: Examples of Logging in a complex GUI program

  1. #1
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default 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

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default 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.
    Fubarable likes this.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Examples of Logging in a complex GUI program

    Thanks for the great insights, doWhile!

Similar Threads

  1. How complex is too complex for a single class?
    By manji51 in forum AWT / Swing
    Replies: 7
    Last Post: 07-08-2011, 07:20 PM
  2. Cant find src for SWT examples
    By F-Man in forum SWT / JFace
    Replies: 0
    Last Post: 10-16-2009, 02:35 AM
  3. Dialog Examples in SWT
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-02-2008, 07:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •