Replace pcgen.base.logging SPI with java.lang.System.Logger#7644
Open
Vest wants to merge 1 commit into
Open
Conversation
The hand-rolled SPI (Logging + Severity) duplicated what the JDK has shipped since Java 9 as java.lang.System.Logger. With the toolchain on Java 25, the custom abstraction is pure tax. Delete both classes, drop the pcgen.base.logging export from module-info, and migrate the two PCGen-Formula call sites (GetOptionalFunction, EvaluateVisitor) to System.Logger with class-named loggers under the pcgen.* JUL parent. No runtime-behaviour change: the JDK's default LoggerFinder routes to JUL, which is the pipeline root code/'s pcgen.util.Logging already configures.
Contributor
Author
|
I'd like to have a single logging system for the entire project. Until now, we have 3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
PCGen-base shipped a tiny custom logging SPI (
pcgen.base.logging.Logging+Severityenum) whose explicit purpose, per its Javadoc, was to keep the base library free of external dependencies while letting host applications plug a real backend in viasetProcessor(...). The JDK has shipped exactly this SPI since Java 9 asjava.lang.System.Logger+System.LoggerFinder, and PCGen's toolchain is now Java 25 (PCGen-base/build.gradle,PCGen-Formula/build.gradle).So the custom abstraction is pure tax: a maintenance liability that duplicates a JDK-standard SPI which contributors already recognise on sight.
What this change does
PCGen-base/code/src/java/pcgen/base/logging/Logging.javaandSeverity.java.exports pcgen.base.logging;fromPCGen-base/code/src/java/module-info.java.System.Logger:pcgen.base.formula.function.GetOptionalFunctionpcgen.base.formula.visitor.EvaluateVisitorThe migration pattern is one-for-one:
System.Loggerprovides theSupplier<String>overload, so the existing lazy-evaluation pattern carries over unchanged.Runtime behaviour
Unchanged. The JDK's default
LoggerFinderroutesSystem.Loggertojava.util.logging, which is exactly the pipeline rootcode/'spcgen.util.Logging(and itsstatic {}bootstrap oflogging.properties,SourceLogFormatter,LoggingRecorder, …) already configures. The new logger names (pcgen.base.formula.function.GetOptionalFunction,pcgen.base.formula.visitor.EvaluateVisitor) sit under the existingpcgen.*JUL parent, so they pick up current config with nologging.propertiesedits.PCGen-basedoes not needrequires java.logging;becauseSystem.Logger/System.LoggerFinder/System.getLoggerall live injava.base. The base module is still dependency-free; if a host ever wants to plug in SLF4J / Log4j2 instead of JUL, it does so via the JDK-standardLoggerFinderSPI rather than a customsetProcessorcall.Scope, intentional non-scope
In scope:
Out of scope (deliberately — separate, independent follow-ups):
code/'spcgen.util.Loggingis untouched. It continues to own JUL bootstrap,PCGenLogLevel.LST_*levels,isDebugModetoggle, localization, error-count helpers, andLoggingRecorderwiring. None of that disappears by switching the base SPI.Verification
grep -rn "pcgen\.base\.logging" PCGen-base PCGen-Formula code→ no matches../gradlew :PCGen-base:compileJava :PCGen-Formula:compileJava→ BUILD SUCCESSFUL../gradlew :PCGen-base:test :PCGen-Formula:test→ BUILD SUCCESSFUL.Diff: 5 files changed, +14 / −126.