Biztalk Log4Net [closed]

杀马特。学长 韩版系。学妹 提交于 2019-12-10 18:38:27

问题


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.


回答1:


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 .




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2626548/biztalk-log4net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!