Skip to content

Advanced logging and writing logfiles #1713

@hohwille

Description

@hohwille

Feature idea

IDEasy should support writing log files so that errors can later be reported even when console output is already lost.
Together with #404 we should rework our entire logging mechanism and reduce reinventing the wheel.
Writing of logfiles should be enabled by default and users can disable the feature via variable:

IDE_WRITE_LOGFILE=false

Additional details:

  • We define our own log-levels for JUL for all levels including those that already exist by default (like INFO or WARNING) and assign priorities starting at 1000 so that direct normal JUL logging from JDK or 3rd party can never interfere undesired but we can log whatever we want.
  • We have SLF4J log-level (threshold) always to TRACE and write details into the log-file independent from --debug (or --trace) option but only use that for the console output.
  • We change tests to log only DEBUG+ to console since the TRACE logs really spam the test output causing significant waste and making it harder to find things. If we ever hit the situation again that a test only fails on github and we need trace logging to trace it down, we can still temporary enable TRACE in the PR.
  • We include more information like project name and sub-command into logfile to easier find relevant logs.

Additional context

So far we have implemented our own logging system with sophisticated features like buffering log events even before knowing the actual log-level and replay them once known. We also use log event buffering for assertions of logs in JUnits.
Further we have created custom log-levels that do not exist in JUL or SLF4J.
Also we have coloured log output.
All these features must still be available after the refactoring.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestloggingIDEasy specific logging (levels, messages, etc.)

Projects

Status

🏗 In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions