logging RRS feed

  • Question

  • User-745244032 posted

    This is not really a ENTLIB (but could be perhaps) but more of something that I think PnP folk might be "been there done that" on.

    Just wondering if anyone has put in any time/thought into getting asp.net application logging output into the same format as SharePoint ULS logs, via log4net or common.logging or system.diagnostics.trace so that you can read it with the ULSviewer tool?

    I find the ULS tool very powerful and makes finding errors less onerous, so was just wondering if its been done that I could use in some of our projects, to unify logging tools/techniques that we are using...

    having said that our infrastructure team is currently setting up splunk and encouraging us to get on board with that... so maybe that is the direction I should be focusing...

    thoughts and suggestions welcome

    Wednesday, November 4, 2015 7:35 AM

All replies

  • User401857628 posted


    I will be much easier to answer if you provide "SharePoint ULS format" :)

    P.S. I did not use ULSviewer before, and can't imagine which, so incredible useful, information provided in SP logs. 

    Saturday, November 7, 2015 4:02 PM
  • User-745244032 posted
    Im not so expert at it but I think its like this-

    Time server threadid correlationid severity type message.

    Im not sure how practical it would be for aspnet app because it's always one line nevr includes stack trace

    The useful bits in the tool are -
    If you hover or click a threadid or severity or anything it highlights it through the whole log.
    You can append a vuch of them tighter so you don't have to flip through multiple files if events are long
    You can dynamically filter by severity (so verbose info only warning error)

    I've not used much either but it's useful... Was wondering if its something that anyone has done and if it paid off or wasn't worth it, abd what a better tool-approach might be.
    Saturday, November 7, 2015 4:19 PM
  • User401857628 posted


    Lets say you will use NLog (https://github.com/NLog/NLog)

    Than according to the documentation https://github.com/NLog/NLog/wiki/Layout-Renderers

    to get this: Time server threadid correlationid severity type message.

    you need specify following layout="${longdate:universalTime=true} ${threadid} ${guid} ${uppercase:${level}} ${message}"

    Everything is easy achievable if you clearly understand what are you need to achieve :)

    Saturday, November 7, 2015 5:03 PM
  • User-745244032 posted

    Yep, I understand the formatting requirements for most logging systems templating is very similar, however what I was after was really something more like insight into these things:

    1) from my experience anytime an EXCEPTION is put into theset hings they include linebreaks, thus ruining the capabilities of such log readers expecting single line per entry (makes it easier to read in text editor tho, so this may not be configurable...

    2) if anyone had done something like this or has another tool suggestion - something that makes trawling through and correlating log "event streams" (eg: following a thread or users "log path" only amongst multi-threaded systems or various types of concurrencies...

    Thanks anyway for your input....

    (UPDATE: Although perhaps true EXCEPTIONS should be logged elsewhere (event/email/other)...??? hadn't thought about that side of things... maybe true ERROR/CRITICAL should be pushed to a different sink/listener from the more verbose stuff like info/warning...?)

    Saturday, November 7, 2015 8:12 PM