Skip to content

Update logging configuration to fix jade about loggers --test - #12

Merged
leslieyip02 merged 5 commits into
masterfrom
fix/logback-setup
Sep 10, 2026
Merged

Update logging configuration to fix jade about loggers --test#12
leslieyip02 merged 5 commits into
masterfrom
fix/logback-setup

Conversation

@leslieyip02

@leslieyip02 leslieyip02 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

When running commands with --log=debug or any log level (e.g. jade --log=debug decompile *.class .), the logs of the corresponding levels aren't printed. When running jade about loggers --test, there are no logs printed for any of the loggers:

Screenshot 2026-09-07 at 8 25 26 PM

This was caused because the logger name parsing logic incorrectly interpolated level instead of name:

for ((name, level) in log) {
// TODO: warn if log exists
// TODO: warn if no such class or package (and suggest qualifications)
val parsedName = when {
name.startsWith(".") -> name.substring(1)
name == "" -> ""
else -> "org.ucombinator.jade.${level}" // TODO: autodetect or take from BuildInfo
}
Log.getLog(parsedName).setLevel(level)
}

This has been fixed:

val parsedName = when {
  name.startsWith(".") -> name.substring(1)
  name == "" -> ""
  else -> "$logRoot.${name}"
}
Screenshot 2026-09-07 at 8 20 54 PM

Furthermore, instead of printing all available loggers, jade about loggers now only prints the loggers created by Jade. This is because external dependencies also had their own loggers, which adds noise to the output. Listing the loggers of external dependencies may or may not be useful, so this functionality has been gated behind the --alll flag.

I also added an option --log-to-file so that it logs to the logs/ directory when the flag is set.

Screenshot 2026-09-07 at 8 21 11 PM

Additionally, some TODOs were tackled too:

  • Use BuildInformation.group instead of hardcoding org.ucombinator.jade.
  • Set DynamicCallerConverter's depth config fields to private.
  • Add KDoc for Log.

The default log level was also set to INFO so that debug logs from external dependencies aren't logged on every command:

Screenshot 2026-09-07 at 8 38 23 PM

@leslieyip02 leslieyip02 changed the title fix: Logback config Update logging configuration to fix jade about loggers --test Sep 7, 2026
`jade about loggers` was broken, so it has been updated in 2 ways:

1. When the `--test` flag is set, it is supposed to cause each
   registered logger to print a message at a particular log level.
   However, this was not working as `parsedName` interpolated the log
   level instead of the log level name.
2. Instead of printing all available loggers, it only prints the loggers
   created by Jade. This is because external dependencies also had their
   own loggers, which adds noise to the output. If you do wish to see
   those loggers from the external dependencies, use the
   `--all` flag.

Also added config for the FILE appender in logback.xml so that it logs
to the logs/ directory.

Additionally, some TODOs were tackled too:

- Use `BuildInformation.group` instead of hardcoding org.ucombinator.jade.
- Set `DynamicCallerConverter`'s depth config fields to private.
- Add KDoc for `Log`.
@leslieyip02

leslieyip02 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Removed the old logic to scan the Jade JAR.

org.ucombinator
org.ucombinator.jade
org.ucombinator.jade.maven
org.ucombinator.jade.maven.JadeMetadataResolver
org.ucombinator.jade.maven.Maven
org.ucombinator.jade.util
org.ucombinator.jade.util.Log

The older JAR scanning logic detected 2 extra loggers:

org.ucombinator.jade.util
org.ucombinator.jade.util.Log

But this is because I took out log from Log, so there are no differences in the loggers detected.

Added a TODO for this limitation.

@leslieyip02
leslieyip02 merged commit cfb4c6e into master Sep 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant