Skip to content

Avoid Castle's default trace logging#1673

Open
Youssef1313 wants to merge 2 commits intodevlooped:mainfrom
Youssef1313:patch-2
Open

Avoid Castle's default trace logging#1673
Youssef1313 wants to merge 2 commits intodevlooped:mainfrom
Youssef1313:patch-2

Conversation

@Youssef1313
Copy link
Copy Markdown

Castle's trace logging can have severe perf impact as the log operations are all locking, so it can slow down significantly test runs that are parallelized.

@Youssef1313
Copy link
Copy Markdown
Author

Youssef1313 commented May 2, 2026

Trace logging being enabled looks like a Castle bug in the first place, specific to .NET Framework.

castleproject/Core#745 is a proposed fix. Whether or not you would consider disabling the logging completely by default is up to you, and also very much depends on the outcome of castleproject/Core#745.

Comment on lines +37 to +40
this.generator = new ProxyGenerator()
{
Logger = NullLogger.Instance,
};
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

An alternative here might be (this.generator.Logger as TraceLogger)?.Level = LoggerLevel.Warn

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like that better, yes

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.

2 participants