-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add CategoryName to output #9
Comments
Hi Dominick, I'm not sure we have any handling for this currently - I'm not actually sure how CategoryName propagates through the logging pipeline to be honest. Any insights here would be appreciated. Definitely sounds like something we should support, if it's native to m.f.Logging. |
Well - I don't know either. Need to look at their source code. Thought that's pretty fundamental. In LibLog I always used {Name} in the format string. |
Could someone help out? @danroth27 @HaoK @rynowak |
@nblumhardt - the category name is what's passed in here: https://github.com/serilog/serilog-framework-logging/blob/dev/src/Serilog.Framework.Logging/SerilogLoggerProvider.cs#L31 |
Thanks @rynowak. It looks like we should attach the @leastprivilege how is the scope name actually set, when calling an |
@leastprivilege sorry, I see that is in your original post. What I guess is throwing me off is how it fits with the hierarchical nature of the scopes, if it can only be set when creating the root logger? Cheers! :-) |
I remember seeing something about nested scopes in the source code. But for now I would be happy if the simple "name" would work ;) |
Was this ever resolved? |
No, not as yet - any help here would be great. |
Not sure if it was updated since this question was asked, but So it should be available from However, I'm wondering.. is there a way to conditionally emit it on the templates only if its available?
ends up with the verbatim string |
@prasannavl I think you need to omit the |
@nblumhardt, if I omit it, it ends up with quotes around it. |
@nblumhardt - Actually, omitting |
Interesting - are you using an old Serilog build? (Know that is unlikely - but the change to omit empty properties has been in there for a while, may be a bug here?) |
Build info from
|
I'm also interested in this. |
Thanks for the notes and follow-ups. This is a bug in The other sinks (Console, Literate Console) shouldn't have the issue. Serilog.Sinks.LiterateConsole is by far my favourite console option now BTW, so worth trying out if you haven't already! Hoping we'll get some traction on the issue linked above for 2.0 RTM (feel free to take a shot at it if you get an opportunity). Thanks again! |
Tried it, much better! Thanks for the recommendation =) |
Looks like this is covered by |
By default Serilog does not output the CategoryName e.g.:
var logger = loggerFactory.CreateLogger("test");
I tried a couple of templates - e.g.
.WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({CategoryName:l}) {Message}{NewLine}{Exception}")
but it does not work - any pointers?
thanks
The text was updated successfully, but these errors were encountered: