[xwiki/xwiki-dev-llm] 4a60a0: [Misc] Record that a log argument is an object, no...
Branch: refs/heads/misc-logging-arguments Home: https://github.com/xwiki/xwiki-dev-llm Commit: 4a60a0afe9472d93e64861393e96d67c6ae9b4e3 https://github.com/xwiki/xwiki-dev-llm/commit/4a60a0afe9472d93e64861393e96d6... Author: Vincent Massol <[email protected]> Date: 2026-08-03 (Mon, 03 Aug 2026) Changed paths: M xwiki/instructions/xwiki-org.md A xwiki/okf/conventions/logging.md M xwiki/okf/index.md Log Message: ----------- [Misc] Record that a log argument is an object, not text A logging pass over commons and platform removed explicit toString() calls on log arguments as "redundant, since SLF4J calls toString() itself". That reasoning is wrong for XWiki, because SLF4J is not the only consumer of a log event: AbstractJobStatus captures every warn/error on a job thread, the LogEvent keeps the raw Object[], SafeMessageConverter XStream-serializes each argument as a full object graph whenever XStreamUtils.isSerializable() accepts it (which defaults to true), SafeArrayConverter turns any read failure into null, and consumers read arguments by type -- the log displayers render references as links and Importer casts getArgumentArray()[0] to EntityReference. So both directions are wrong in different cases, which is what the new conventions/logging.md records: the decision table for when to keep an argument typed (references, extension ids, enums, components, collections) and when to force an eager String (arbitrary sources, live resources such as a Hibernate Session, mutable builders, requests, an object whose toString() is deliberately narrower than its fields, a Class from an extension jar), plus the two wrong justifications for removing a toString() and how java:S2629 actually behaves -- String-typed arguments only, no-arg getters and catch blocks exempt -- so that a suppression is only added where one is really needed. The always-on instructions get the short form, since the damaging case is an agent "cleaning up" a toString() without having loaded the OKF file. Co-authored-by: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-dev-llm/settings/notifications
participants (1)
-
XWiki Notifications