Class LogPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, EventBatchListener, Profileable, SettingsListener

public class LogPanel extends DockablePanel implements EventBatchListener, Profileable
A LogPanel provides a view to a collection of LoggingEvents.

As events are received, the keywords in the 'tab identifier' application preference are replaced with the values from the received event. The main application uses this expression to route received LoggingEvents to individual LogPanels which match each event's resolved expression.

The LogPanel's capabilities can be broken up into four areas:
  • toolbar - provides 'find' and 'refine focus' features
  • logger tree - displays a tree of the logger hierarchy, which can be used to filter the display
  • table - displays the events which pass the filtering rules
  • detail panel - displays information about the currently selected event
Here is a complete list of LogPanel's capabilities:
  • display selected LoggingEvent row number and total LoggingEvent count
  • pause or unpause reception of LoggingEvents
  • configure, load and save column settings (displayed columns, order, width)
  • configure, load and save color rules filter displayed LoggingEvents based on the logger tree settings
  • filter displayed LoggingEvents based on a 'refine focus' expression (evaluates only those LoggingEvents which pass the logger tree filter
  • colorize LoggingEvents based on expressions
  • hide, show and configure the detail pane and tooltip
  • configure the formatting of the logger, level and timestamp fields
  • dock or undock
  • table displays first line of exception, but when cell is clicked, a popup opens to display the full stack trace
  • find
  • scroll to bottom
  • sort
  • provide a context menu which can be used to build color or display expressions
  • hide or show the logger tree
  • toggle the container storing the LoggingEvents to use either a CyclicBuffer (defaults to max size of 5000, but configurable through CHAINSAW_CAPACITY system property) or ArrayList (no max size)
  • use the mouse context menu to 'best-fit' columns, define display expression filters based on mouse location and access other capabilities
Author:
Scott Deboy (sdeboy at apache.org), Paul Smith (psmith at apache.org), Stephen Pain, Isuru Suriarachchi
See Also:
  • Constructor Details

    • LogPanel

      public LogPanel(ChainsawStatusBar statusBar, String identifier, int cyclicBufferSize, Map<String, RuleColorizer> allColorizers, ApplicationPreferenceModel applicationPreferenceModel)
      Creates a new LogPanel object. If a LogPanel with this identifier has been loaded previously, reload settings saved on last exit.
      Parameters:
      statusBar - shared status bar, provided by main application
      identifier - used to load and save settings
  • Method Details

    • isScrollToBottom

      public boolean isScrollToBottom()
      Accessor
      Returns:
      scrollToBottom
    • setRefineFocusText

      public void setRefineFocusText(String refineFocusText)
    • getRefineFocusText

      public String getRefineFocusText()
    • toggleScrollToBottom

      public void toggleScrollToBottom()
      Mutator
    • scrollToTop

      public void scrollToTop()
    • getNamespace

      public String getNamespace()
      Accessor
      Specified by:
      getNamespace in interface Profileable
      Returns:
      namespace
      See Also:
    • getInterestedIdentifier

      public String getInterestedIdentifier()
      Accessor
      Specified by:
      getInterestedIdentifier in interface EventBatchListener
      Returns:
      identifier
      See Also:
    • receiveEventBatch

      public void receiveEventBatch(String ident, List<org.apache.log4j.spi.LoggingEvent> events)
      Process events associated with the identifier. Currently assumes it only receives events which share this LogPanel's identifier
      Specified by:
      receiveEventBatch in interface EventBatchListener
      Parameters:
      ident - identifier shared by events
      events - list of LoggingEvent objects
    • loadSettings

      public void loadSettings(LoadSettingsEvent event)
      Load settings from the panel preference model
      Specified by:
      loadSettings in interface SettingsListener
      Parameters:
      event -
      See Also:
    • saveSettings

      public void saveSettings(SaveSettingsEvent event)
      Save preferences to the panel preference model
      Specified by:
      saveSettings in interface SettingsListener
      Parameters:
      event -
      See Also:
    • centerAndSetVisible

      public static void centerAndSetVisible(Window window)
    • updateFindRule

      public void updateFindRule(String ruleText)
    • updateStatusBar

      protected void updateStatusBar()
      Update the status bar with current selected row and row count
    • findNextColorizedEvent

      public void findNextColorizedEvent()
    • findPreviousColorizedEvent

      public void findPreviousColorizedEvent()
    • findNext

      public void findNext()
      Finds the next row matching the current find rule, and ensures it is made visible
    • findPrevious

      public void findPrevious()
      Finds the previous row matching the current find rule, and ensures it is made visible
    • findNextMarker

      public void findNextMarker()
    • findPreviousMarker

      public void findPreviousMarker()
    • clearAllMarkers

      public void clearAllMarkers()
    • toggleMarker

      public void toggleMarker()
    • layoutComponents

      public void layoutComponents()
    • setFindText

      public void setFindText(String findText)
    • getFindText

      public String getFindText()