Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

TraceSourceLoggerProvider > InitializeTraceSource is no use #141

Closed
RainingNight opened this issue Mar 5, 2015 · 4 comments
Closed

TraceSourceLoggerProvider > InitializeTraceSource is no use #141

RainingNight opened this issue Mar 5, 2015 · 4 comments

Comments

@RainingNight
Copy link

The Listeners and Switchs always to the same with _rootSourceSwitch !!

https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Framework.Logging/TraceSourceLoggerProvider.cs#L16

davidfowl added a commit that referenced this issue Mar 5, 2015
- Moved TraceSourceLogger to Microsoft.Framework.Logging.TraceSource
- Removed Logging dependency from all providers, they only need
the .Interfaces reference
- Moved WriteContext to the test project
- Added an extension method AddTraceSource to add the TraceSource provider
- Added AddLogging to the Logging project
- Removed RootTraceName

#142
#141
#140
@davidfowl
Copy link
Member

?

@RainingNight
Copy link
Author

Why use TraceSource parentTraceSource = GetOrAddTraceSource(parentSourceName) ?
All the created logger by TraceSourceLoggerProvider that always use the _rootSourceSwitch and _rootTraceListener !
How to set different switch and listener for each logger?

@davidfowl
Copy link
Member

What's the scenario you're trying to accomplish? The pattern here allows you to filter traces by prefix. It means that you can turn tracing on for Microsoft.AspNet and get all of the logs:

http://www.tugberkugurlu.com/archive/logging-in-the-owin-world-with-microsoft-owin--introduction

Check out this blog for an example.

@RainingNight
Copy link
Author

Oh, I see ! I forgot can configure the switch and listener in the web.config. Thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants