GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixes from the 2026-11 audit, part 2: logging core, batches and mail by FreeAndNil · Pull Request #364 · apache/logging-log4net

Conversation

@FreeAndNil

@FreeAndNil FreeAndNil commented Nov 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

#358 Fixes from the 2026-11 audit, part 2: logging core, batches and mail

  • Eight commits, one per finding
  • Closes Application objects that throw while being rendered break logging #358, closes One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359, closes Pickup mail without MIME headers #360
  • XML layouts read back one whitespace character as another #361 also needs the tab fix of a later PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@FreeAndNil
#358 Render an exception that cannot render itself by its type names
d2bae0c
- LogLog, RendererMap and LoggingEvent's last resort use ToStringSafe
- ANT-2026-F4RWPVSV
@FreeAndNil FreeAndNil added this to the 3.6.1 milestone Nov 16, 2026
@FreeAndNil FreeAndNil self-assigned this Nov 16, 2026
FreeAndNil added 7 commits November 16, 2026 21:14
@FreeAndNil
#358 Format NDC.PushFormat like ILog.*Format, so a failing argument d…
7b313a6
…oes not throw

- ANT-2026-PZUYSLEY
@FreeAndNil
#359 Let one failing event cost only itself in batches, filters and m…
24478ab
…ails

- Per-event catch in AppenderSkeleton, AppenderAttachedImpl, MailBodies.Render
- ANT-2026-PSTH1UQ1
@FreeAndNil
#359 Take an undefined filter decision as Neutral instead of looping …
a66629a
…forever

- StringMatchFilter.TimeoutDecision rejects undefined values
- ANT-2026-VKBDETLN
@FreeAndNil
#358 Write an error text for an exception member that throws under %e…
6750b8c
…xception{...}

- ANT-2026-O16FBEKV
@FreeAndNil
#359 Hand a batch to the Append(LoggingEvent[]) overrides again
ff2f4f4
- DoAppend(LoggingEvent[]) calls the array overload, as before 3.0.0
- one file lock, roll check and flush per batch
- Append(IEnumerable) overrides calling back no longer recurse
@FreeAndNil
#360 Write MIME headers in pickup mails, the body as 8bit or base64
79fc9bf
- ANT-2026-TNHX6V52
@FreeAndNil
#361 Write CR and LF in XML element text as character references
4cf5846
- ANT-2026-HQWYRAWL
@FreeAndNil
FreeAndNil requested review from fluffynuts and gdziadkiewicz November 16, 2026 21:34
@FreeAndNil
FreeAndNil marked this pull request as ready for review November 16, 2026 21:49
fluffynuts
fluffynuts approved these changes Nov 17, 2026
View reviewed changes

@fluffynuts fluffynuts left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions, but nothing that is absolutely critical.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/log4net/Appender/AppenderSkeleton.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/log4net/Util/Log4NetAssert.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/log4net/NDC.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

FreeAndNil added 2 commits November 18, 2026 00:44
@FreeAndNil
#364 Hide NDC and MDC from the editor instead of the commented-out Ob…
559518b
…solete markers
@FreeAndNil
#364 Test the SMTP send deadline without a timing race
0c04cde
fluffynuts
fluffynuts approved these changes Nov 18, 2026
View reviewed changes
@FreeAndNil
FreeAndNil merged commit eef46d6 into master Nov 18, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@FreeAndNil
FreeAndNil deleted the Feature/2026-11-audit-chain-a branch November 18, 2026 07:55
@FreeAndNil

FreeAndNil commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Implementation plan for #364, kept here for the record. Written up to describe the change as it stands on the branch.

Plan

Fixes from the 2026-11 audit, part 2

Context

The scan behind #355 also reported a set of lows in the logging core, the batch path, the pickup
mail and the XML layouts. This PR fixes them, grouped into four issues: #358 (application objects
that throw while being rendered), #359 (one failing event costs a whole batch; bulk overrides unused
since 3.0.0), #360 (pickup mail without MIME headers) and #361 (XML layouts read back one whitespace
character as another; the tab half follows in a later PR). Two commits close #364's own points
raised in review: NDC and MDC hidden from the editor, and an SMTP test without a timing race.

The rule behind every fix: configuration is trusted, log content and application objects are not.
A failing object costs its own text, never the record, the batch or the logging call.

Constraints that shape the design

  • LogLog writes exception.ToString(); it is called from the catch blocks that report rendering
    failures, so a throwing ToString() there escaped them all.
  • NDC.PushFormat formatted with string.Format, unlike ILog.*Format, which goes through
    SystemStringFormat and writes an error text.
  • Since 3.0.0 DoAppend(LoggingEvent[]) passed a list and reached only Append(IEnumerable), so
    the Append(LoggingEvent[]) overrides of the file appenders never ran.
  • A filter loop moves on only for the three defined decisions.
  • RFC 5322 limits a line to 998 octets; a pickup mail had no MIME headers at all.
  • An XML parser normalises CR and CR LF to LF in element text.

Changes

  1. Application objects that throw while being rendered break logging #358 LogLog, the error text of a failed rendering and the last-resort exception text of
    LoggingEvent fall back to the type names when ToString() throws.
  2. Application objects that throw while being rendered break logging #358 NDC.PushFormat formats through SystemStringFormat: a failing argument or a malformed
    format string pushes the error text ILog.InfoFormat writes. A null format still throws.
  3. One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359 Per-event catch in the base batch loop, the filter loop, CallAppenders and
    MailBodies.Render: a throwing layout, filter or appender costs its own event, reported on its
    own. The mail appenders write an error text in place of an event that fails to render.
  4. One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359 An undefined FilterDecision counts as Neutral; StringMatchFilter.TimeoutDecision
    rejects one, and from configuration it is reported and the default kept.
  5. Application objects that throw while being rendered break logging #358 %exception{member}: a member that throws writes an error text instead of cutting the
    record.
  6. One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359 DoAppend(LoggingEvent[]) hands the array to Append(LoggingEvent[]) again: one file lock,
    roll check and flush per batch. ForwardingAppender hands each attached appender the whole batch
    in turn. A re-entrancy flag keeps a subclass that overrides only one overload working.
  7. Pickup mail without MIME headers #360 SmtpPickupDirAppender writes MIME-Version, Content-Type: text/plain; charset=utf-8 and
    Content-Transfer-Encoding: 8bit, or base64 when a line exceeds 998 octets or the layout
    header or footer holds a NUL. A NUL from content is written as \0.
  8. XML layouts read back one whitespace character as another #361 XmlLayout and XmlLayoutSchemaLog4J write each CR and LF in message, exception text and
    NDC as a character reference; text with a line break is escaped instead of written as CDATA. A
    multi-line record is one physical line in the file.
  9. Fixes from the 2026-11 audit, part 2: logging core, batches and mail #364 NDC, MDC and their members get [EditorBrowsable(Never)] instead of the commented-out
    [Obsolete]; the API reference keeps their pages.
  10. Fixes from the 2026-11 audit, part 2: logging core, batches and mail #364 The SMTP send deadline test waits on a signal instead of a delay.

Docs: the XML doc comments of the changed members, the pickup, XML layout and filter pages where
they describe the old behaviour. One changelog entry per change in src/changelog/3.6.1.

Sequencing

  1. Application objects that throw while being rendered break logging #358 LogLog first: every later catch block reports through it.
  2. Application objects that throw while being rendered break logging #358 NDC.PushFormat, then One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359 the per-event catch and the filter decision, then Application objects that throw while being rendered break logging #358
    %exception{member}.
  3. One failing event costs a whole batch; bulk overrides unused since 3.0.0 #359 the bulk path, after the per-event catch it builds on.
  4. Pickup mail without MIME headers #360 pickup headers, then XML layouts read back one whitespace character as another #361 the XML line breaks, which make an XML record one line and so
    rely on the pickup body being able to carry long lines.
  5. Each commit: test against the unfixed code first, fix, mutate each changed line, review loop.
  6. Commits and pushes are the maintainer's.

Verification

  • dotnet build of all targets with 0 warnings, tests on net10 and, on Windows, net462.
  • Each fix tested against the unfixed code first, and the changed lines mutated.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FreeAndNil FreeAndNil mentioned this pull request Nov 23, 2026
Fixes from the 2026-11 audit, part 6: syslog notes, XML layouts and Telnet #376
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@fluffynuts fluffynuts fluffynuts approved these changes
@gdziadkiewicz gdziadkiewicz Awaiting requested review from gdziadkiewicz

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@FreeAndNil FreeAndNil

Labels

None yet

Projects

None yet

Milestone

3.6.1

Development

Successfully merging this pull request may close these issues.

Pickup mail without MIME headers One failing event costs a whole batch; bulk overrides unused since 3.0.0 Application objects that throw while being rendered break logging

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@FreeAndNil @fluffynuts
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.