开发者

Biztalk Log4Net [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
开发者_开发问答

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 7 years ago.

Improve this question

Has anyone used log4net with Biztalk? We are currently looking into using it and are trying to access pros/cons, and whether or not it would meet our needs.


I have used Log4Net with BizTalk, but i will say that out of the box i ran into issues. Every call out of BizTalk results in the current orchestration getting dehydrated (serialized) so any type you use in BizTalk would have to be serializable and the log4net logger was not.

If you absolutely have to use log4net there is a wrapper that Scott Colestock wrote here.

Assuming you are not locked in, i would just use Enterprise Logging, it offers almost the same functionality as log4net and works out of the box with BizTalk. You can find it here.

For pros and cons, i will say that offer almost exact functionality, I actually ended up creating a wrapper utility that made the Enterprise Library Logging Block look more like log4net.

 public static class Logging
{

    public static void LogMessage(TraceEventType eventType, string category, string message)
    {
        LogEntry logEntry = new LogEntry();
        logEntry.Severity = eventType;
        logEntry.Priority = 1;
        logEntry.Categories.Add(category);
        logEntry.Message = message;
        Logger.Write(logEntry);

    }

    public static void LogError(string category, string message)
    {
        LogMessage(TraceEventType.Error, category,message);
    }

    public static void LogInfo(string category, string message)
    {
        LogMessage(TraceEventType.Information, category, message);
    }
    public static void LogVerbose(string category, string message)
    {
        LogMessage(TraceEventType.Verbose, category, message);
    }
}

And if you need more look here .


Have you considered using ETW. This in my opinion is the way to go for instrumenting BizTalk. http://blogs.msdn.com/b/asgisv/archive/2010/05/11/best-practices-for-instrumenting-high-performance-biztalk-solutions.aspx

One of the drawbacks of using both log4net and Enterprise Logging is you need config to enable it. So you have to manage the btsntsvc.exe.config files on all servers in your biztalk group which can be an overhead.

ETW is zero config.


I've got to say that after using both log4net and MS Enterprise Library for application logging on different projects, I prefer log4net. I particularly like the way that with log4net you can centralise the configuration in a single place (e.g. database), rather than having to rely on local server app.config for the btsntsvc.exe.

This is particularly useful if you need to spin out new server instances to add to your farm - you've got enough to do without worrying about logging config. I've used log4net with both BTS2004 and BTS2006R2 and been satisfied. One thing I would recommend whichever logging framework you go with, don't fall into the trap of using the Event Log as a sink - when you scale out across 10 BTS app servers, it is a time consuming process to track errors, particularly as orchestration instances have no affinity to an app server and tend to move across your estate! Keep the event log for crucial OS and BTS service issues, rather than custom application errors - makes SCOM monitoring a lot less painless.

FYI - I too use log4net with Colestock's serializable wrapper, albeit with a few tweaks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜