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;








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.










share|improve this question





















  • 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











  • @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

















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.










share|improve this question





















  • 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











  • @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













0












0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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












  • 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











  • @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












1 Answer
1






active

oldest

votes


















0














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






share|improve this answer
























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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






    share|improve this answer





























      0














      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






      share|improve this answer



























        0












        0








        0







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 20:42









        dmoore1181dmoore1181

        4486 silver badges21 bronze badges




        4486 silver badges21 bronze badges





















            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.



















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript