Skip to content

Cleanup of IdeLogEntry, IdeLogListener and IdeGuiLogListener #2385

Description

@laim2003

Task summary

This ticket collects the review suggestions from #2053 (review) that were not resolved before merging. Things to do:

1. IdeLogListener takes an IdeLogEntry as its only argument

  • Change IdeLogListener.onLog(IdeLogLevel, String, String, Object[], Throwable) to boolean onLog(IdeLogEntry entry).
  • Slf4jLoggerAdapter.handleNormalizedLoggingCall builds the IdeLogEntry once and passes it to the listener.
  • Update all implementations: IdeLogListenerBuffer (adds the entry directly instead of creating a new one), IdeLogListenerNone, IdeGuiLogListener and IdeLogListenerCollector (test).
  • Creating an IdeLogEntry for every log event costs very little, and the simpler API is worth it.

2. IdeLogEntry: timestamp as Instant

  • Change the record component Long timeStamp to Instant timestamp and create it with Instant.now(). An Instant is readable in the debugger and in toString(), while a long is just a large number.
  • In displayValue(), make the DateTimeFormatter a static final constant instead of creating it on every call. Use the Instant directly.
  • Add the missing @param Javadoc for the timestamp.

3. IdeGuiLogListener: show each message only once

At the moment onLog ignores the return value of super.onLog(...) and always returns true. While the listener is buffering (the default after the constructor), a message:

  • goes into the buffer and is still written to the GUI console at once,
  • is passed on to the regular logger, even though buffering should suppress it,
  • is written to the console a second time when the buffer is flushed.

Fix: only forward the message if the parent class accepts it:

boolean accept = super.onLog(entry);
if (accept && (this.consoleController != null)) {
  this.consoleController.appendOutput(entry);
}
return accept;

4. ConsoleController works with IdeLogEntry

  • IdeGuiLogListener passes the whole IdeLogEntry to the controller. It no longer passes only level + message, and it no longer adds a separate line " Error: " + error.getMessage() at the hard-coded ERROR level.
  • The controller stores the full entry, including error(), so the GUI can show the exception later.
  • Check whether the convenience methods appendOutput(String) and appendOutput(IdeLogLevel, String) are still needed (they are used by GuiOutputListener, CommandletService and ConsolePanelTest).

Out of scope (follow-up ticket): In the console, mark entries that have an exception with an icon. Clicking the icon opens a popup with the full stack trace, which can be scrolled and has a "copy to clipboard" button. This ticket only has to make sure the API keeps the Throwable available for that.

Acceptance criteria

  • IdeLogListener.onLog(IdeLogEntry) is the only listener method, and all implementations are migrated.
  • IdeLogEntry uses Instant for the timestamp, and displayValue() uses a constant formatter.
  • While buffering, a message logged in the GUI shows up exactly once in the console and is not passed on to the regular logger.
  • ConsoleController receives and stores IdeLogEntry objects, including the error.
  • Tests are adjusted or added, at least for the buffering case in IdeGuiLogListener.

Additional context

#2053

Activity

  1. added theissue type on Aug 27, 2026
  2. added
    GUIGraphical User Interface of IDEasy (aka dashboard) build with JavaFx
    on Aug 27, 2026
  3. changed the title [-]Cleanup of IdeLogEntry and IdeGuiListener[/-] [+]Cleanup of IdeLogEntry, IdeLogListener and IdeGuiLogListener[/+] on Oct 8, 2026
  4. moved this from 🆕 New to 🏗 In progress in IDEasy boardon Oct 9, 2026
  5. added a commit that references this issue on Oct 14, 2026
  6. added this to the release:2026.11.001 milestone on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

GUIGraphical User Interface of IDEasy (aka dashboard) build with JavaFxenhancementNew feature or requestgood first issueGood for newcomersinternalNothing to be added to CHANGELOG, only internal storyready-to-implement

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions