fwpUtil
Class LogIt

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by fwpUtil.LogIt
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class LogIt
extends javax.swing.JDialog

Title: A dialog to setup and control logging actions within a program.

This is a small logger capability which was originally written in Pascal and subsequently re-written in C, Ada and now Java. Though vastly smaller than the Java version, it performs the essential logging functions. For comapatibility the names of the logging levels were made the same as\ those used in the Java logger.

Under normal circumstances, a user will not have any reason to use the functions supported by this dialog. As you will see from the following description, the capabilities provide here are of use primarily during program development and testing. However, they are also of critical use when a user runs into a program error or malfunction.

When the users run into a problem, they need to record what they did to create the problem. In other words, they need to provide the program developer with an accurate description of exactly what menu selections they made, what keys they pressed, and what inputs they made. This can be a time consuming task, especially if there are several ways in which The error can be created.

The capabilities provided here make this a whole lot easier. When the program starts the logging function is ormally turned "OFF". Should the suer encounter a problem, or is curious about its internal operation; they can come to this dialog and turn on the logging activities. To see how this all works, the user simply performs the following steps:

1. Click the “ALL” radio button at the bottom the Log Levels radio buttons. This will capture the maximum amount of internal information. It will also erase any old log file which may exist and start a new one.

2. Click the Read the log file button. The log file display window will display a list of actions which have taken place up to this point. The list will look something like the following:

Default LogFile = C:\MicroMap\Log.txt

MainWindowFrame entering constructor

MainWindowFrame entering jbInit

MainWindowFrame exiting jbInit

MainWindowFrame exiting constructor

MainWindowFrame jMenuHelpLog_actionPerformed

LogIt entering constructor

LogIt entering jbInit

Logger getLogFilePath = C:\MicroMap\

Logger getLogFileName = Log.txt

Loading file C:\MicroMap\HelpFiles\LogFileHelp.htm

File C:\MicroMap\HelpFiles\LogFileHelp.htm loaded

LogIt jRadioALL_actionPerformed

LogIt jButtonReadLogFile_actionPerformed

TextViewer file load started.

Loading file C:\MicroMap\Log.txt

This information can be very important when trying to figure out what went wrong in the program. Notice that the location and name of the log file is displayed in the title bar of the window.

2. Click the Done button on the window.

3. Click the Add environment variables button. This will add quite a bit of internal system information to the log file.

4. Click the Read the log file button again. Now the user will see that a large amount of additional information is in the file. Note: the viewer always places the user at the end of the log file so they can automatically see the most recent additions to the file.

5. Click the Done button again to close the window.

6. Click the “OFF” radio button to turn off the logging and then the Done button to close the Program Logging window.

The user can turn the logging function on or off at any time during their use of the program. They can also change the level of logging at any time.

A copy of the default LogItHelp.htm file is located in the fwpUtil package directory.

Example usage:

LogIt log = new LogIt();

// Center the dialog on this parent window

Dimension dlgSize = log.getSize();

Dimension frmSize = this.getSize();

Point loc = this.getLocation();

log.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,

(frmSize.height - dlgSize.height) / 2 + loc.y);

log.setVisible(true);

log = null;

Copyright: Copyright (c) 2011

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LogIt(java.awt.Frame parent)
          The Dialog allows the user to set the desired level of program data logging.
 
Method Summary
 java.lang.String toString()
          Returns the name of the class.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogIt

public LogIt(java.awt.Frame parent)
The Dialog allows the user to set the desired level of program data logging. Thru this dialog the user can set the logging level to one of the following: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, or ALL.

The dialog displays the full path\file name of the log file.

The user can also display the log and help files.

If a frame is provided, the dialog is centered over that frame. Otherwise, if a null is passed, the dialog is positioned 20 pixels down and to the right of the upper left corner of the display screen.

Method Detail

toString

public java.lang.String toString()
Returns the name of the class.

Overrides:
toString in class java.awt.Component
Returns:
The class name, log file path+name, log level and log help file path+name. For example:

LogIt LogFile=D:\A JOptionPanel\Log.txt Log Level=1 HelpFile=D:\A JOptionPanel\LogItHelp.htm