Biztalk Log4Net [英] Biztalk Log4Net

查看:73
本文介绍了Biztalk Log4Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在Biztalk中使用log4net吗?我们目前正在研究使用它,并尝试访问优点/缺点,以及它是否可以满足我们的需求.

解决方案

我已经将Log4Net与BizTalk一起使用,但是我会说开箱即用时会遇到问题.每次BizTalk调用都会导致当前业务流程脱水(序列化),因此您在BizTalk中使用的任何类型都必须可序列化,而log4net记录器则不可.

如果您绝对必须使用log4net,则有一个由Scott Colestock编写的包装器此处.

假设您没有被锁定,我将只使用Enterprise Logging,它提供的功能几乎与log4net相同,并且可以与BizTalk一起使用.您可以在此处找到它.. >

对于优缺点,我会说它提供了几乎准确的功能,实际上我最终创建了一个包装器实用程序,该实用程序使Enterprise Library Logging Block看起来更像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);
    }
}

如果需要更多信息,请这里.

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 .

这篇关于Biztalk Log4Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆