Multiple Serilog LoggersSerilog with Asp.net Web Api not using enricherCatch multiple exceptions at once?Unauthorised webapi call returning login page rather than 401Why not inherit from List<T>?Exception destructuring in SerilogSerilog: Logging different types of log eventsLogging in .NET with SerilogFilter Serilog logs to different sinks depending on context source?C# ASP.NET Core Serilog add class name and method to logSerilog cannot show output logs aspnetcore 2.1 vs 2017Custom ASP.NET Core Logger using Serilog
"A y'vama acquires herself through chalitza", really?
Did Michelle Obama have a staff of 23 people, while Melania has a staff of 4?
Gofer work in exchange for Letter of Recommendation
The Lucky House
My father gets angry everytime I pass Salam, that means I should stop saying Salam when he's around?
Why should I pay for an SSL certificate?
Testing control surfaces pre flight; what feedback does pilot recieve?
Rotate List by K places
Have made several mistakes during the course of my PhD. Can't help but feel resentment. Can I get some advice about how to move forward?
Are unaudited server logs admissible in a court of law?
Polar contour plot in Mathematica?
Levenshtein Neighbours
How does the illumination of the sky from the sun compare to that of the moon?
What's the point of writing that I know will never be used or read?
Meaning and structure of headline "Hair it is: A List of ..."
Linear and Integer programming materials
Radix2 Fast Fourier Transform implemented in C++
Virtual destructor moves object out of rodata section
From France west coast to Portugal via ship?
What security risks does exposing the size of the plaintext entail?
Did Wernher von Braun really have a "Saturn V painted as the V2"?
Unsolved Problems due to Lack of Computational Power
Best model for precedence constraints within scheduling problem
Does git delete empty folders?
Multiple Serilog Loggers
Serilog with Asp.net Web Api not using enricherCatch multiple exceptions at once?Unauthorised webapi call returning login page rather than 401Why not inherit from List<T>?Exception destructuring in SerilogSerilog: Logging different types of log eventsLogging in .NET with SerilogFilter Serilog logs to different sinks depending on context source?C# ASP.NET Core Serilog add class name and method to logSerilog cannot show output logs aspnetcore 2.1 vs 2017Custom ASP.NET Core Logger using Serilog
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Is it possible to have multiple serilog loggers? Currently within my WebApi I can call Log.Information for example to log an information event, but is there a way that I can instead make different logs and call ExternalLog.Information or AuthenticationLog.Information from my controller? The purpose behind this is that my web api is currently working with multiple different databases for different yet interrelated projects, and I would like to store logs within each of these databases that pertain to them instead of needing to create an additional logging database if at all possible.
A better solution, that I figure is less likely is, can I map individual controllers to a log, so that any time that a specific controller calls log, it writes to the AuthenticationLog for example.
c# asp.net-web-api logging serilog
add a comment |
Is it possible to have multiple serilog loggers? Currently within my WebApi I can call Log.Information for example to log an information event, but is there a way that I can instead make different logs and call ExternalLog.Information or AuthenticationLog.Information from my controller? The purpose behind this is that my web api is currently working with multiple different databases for different yet interrelated projects, and I would like to store logs within each of these databases that pertain to them instead of needing to create an additional logging database if at all possible.
A better solution, that I figure is less likely is, can I map individual controllers to a log, so that any time that a specific controller calls log, it writes to the AuthenticationLog for example.
c# asp.net-web-api logging serilog
1
Sure, you can make multiple loggers. What's stopping you from grabbing theILogger
thatnew LoggerConfiguration().CreateLogger();
makes?
– mason
Mar 27 at 20:53
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19
add a comment |
Is it possible to have multiple serilog loggers? Currently within my WebApi I can call Log.Information for example to log an information event, but is there a way that I can instead make different logs and call ExternalLog.Information or AuthenticationLog.Information from my controller? The purpose behind this is that my web api is currently working with multiple different databases for different yet interrelated projects, and I would like to store logs within each of these databases that pertain to them instead of needing to create an additional logging database if at all possible.
A better solution, that I figure is less likely is, can I map individual controllers to a log, so that any time that a specific controller calls log, it writes to the AuthenticationLog for example.
c# asp.net-web-api logging serilog
Is it possible to have multiple serilog loggers? Currently within my WebApi I can call Log.Information for example to log an information event, but is there a way that I can instead make different logs and call ExternalLog.Information or AuthenticationLog.Information from my controller? The purpose behind this is that my web api is currently working with multiple different databases for different yet interrelated projects, and I would like to store logs within each of these databases that pertain to them instead of needing to create an additional logging database if at all possible.
A better solution, that I figure is less likely is, can I map individual controllers to a log, so that any time that a specific controller calls log, it writes to the AuthenticationLog for example.
c# asp.net-web-api logging serilog
c# asp.net-web-api logging serilog
edited Mar 27 at 13:57
dmoore1181
asked Mar 27 at 12:05
dmoore1181dmoore1181
4486 silver badges21 bronze badges
4486 silver badges21 bronze badges
1
Sure, you can make multiple loggers. What's stopping you from grabbing theILogger
thatnew LoggerConfiguration().CreateLogger();
makes?
– mason
Mar 27 at 20:53
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19
add a comment |
1
Sure, you can make multiple loggers. What's stopping you from grabbing theILogger
thatnew LoggerConfiguration().CreateLogger();
makes?
– mason
Mar 27 at 20:53
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19
1
1
Sure, you can make multiple loggers. What's stopping you from grabbing the
ILogger
that new LoggerConfiguration().CreateLogger();
makes?– mason
Mar 27 at 20:53
Sure, you can make multiple loggers. What's stopping you from grabbing the
ILogger
that new LoggerConfiguration().CreateLogger();
makes?– mason
Mar 27 at 20:53
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19
add a comment |
1 Answer
1
active
oldest
votes
I believe that the answer to this question is to use subloggers, rather than separate loggers. I have found that you can do .WriteTo.Logger
and filter further in there. I will accept this as the answer if nobody else has a better solution (and of course if I am able to get it to work). I need to be able to filter on the controller or action name, which at this time I have a second stack overflow question out to figure out how to get that data. Serilog with Asp.net Web Api not using enricher
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376786%2fmultiple-serilog-loggers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I believe that the answer to this question is to use subloggers, rather than separate loggers. I have found that you can do .WriteTo.Logger
and filter further in there. I will accept this as the answer if nobody else has a better solution (and of course if I am able to get it to work). I need to be able to filter on the controller or action name, which at this time I have a second stack overflow question out to figure out how to get that data. Serilog with Asp.net Web Api not using enricher
add a comment |
I believe that the answer to this question is to use subloggers, rather than separate loggers. I have found that you can do .WriteTo.Logger
and filter further in there. I will accept this as the answer if nobody else has a better solution (and of course if I am able to get it to work). I need to be able to filter on the controller or action name, which at this time I have a second stack overflow question out to figure out how to get that data. Serilog with Asp.net Web Api not using enricher
add a comment |
I believe that the answer to this question is to use subloggers, rather than separate loggers. I have found that you can do .WriteTo.Logger
and filter further in there. I will accept this as the answer if nobody else has a better solution (and of course if I am able to get it to work). I need to be able to filter on the controller or action name, which at this time I have a second stack overflow question out to figure out how to get that data. Serilog with Asp.net Web Api not using enricher
I believe that the answer to this question is to use subloggers, rather than separate loggers. I have found that you can do .WriteTo.Logger
and filter further in there. I will accept this as the answer if nobody else has a better solution (and of course if I am able to get it to work). I need to be able to filter on the controller or action name, which at this time I have a second stack overflow question out to figure out how to get that data. Serilog with Asp.net Web Api not using enricher
answered Mar 27 at 20:42
dmoore1181dmoore1181
4486 silver badges21 bronze badges
4486 silver badges21 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376786%2fmultiple-serilog-loggers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Sure, you can make multiple loggers. What's stopping you from grabbing the
ILogger
thatnew LoggerConfiguration().CreateLogger();
makes?– mason
Mar 27 at 20:53
@mason - "Sure, you can make multiple loggers. What's stopping you from grabbing the ILogger that new LoggerConfiguration().CreateLogger(); makes? " Worked for me. Seems a lot simpler than sublogging. It seems to me that sublogging is to break a single source of log events into logs for that particular part of the app?
– Eric Snyder
May 22 at 14:19