Use the Log function in Biztalk :)

Source: Internet
Author: User
Tags biztalk
In the past few days, for some other reasons, we have to use BizTalk to complete a workflow... just a little dizzy. Basically, I don't understand it.
However, fortunately, there are some teaching discs on BizTalk of M $. At last we know what BizTalk is like :)

To be honest, BizTalk is really a good thing and can easily implement complicated workflows. the implementation method is relatively simple, as long as the xml Schema is designed. drag various controls into the business process as you imagine. next, deploy it in BizTalk. you can run it :)
At the same time, BizTalk can be directly published as WebService, which solves a lot of problems for development...

In short, the BizTalk software is so powerful... a word. "Great ".

During the learning process, I ran BizTalk on a virtual machine. The memory of my machine was not high, and the CPU was not strong. It was really slow to run :(
It is not very slow during development. However, once the deployment is complete, errors are found when the business process is running, and debugging is troublesome.
(You think about it. In a virtual machine, run.. NET 2003 ., bizTalk, SQL Server, and then debug the business process through BizTalk's "running status and activity tracking :()

Fortunately, BizTalk provides an "expression" that can call all static methods in. NET...
Here, we can use it directly. the FileStream in. NET records every step of the process (although it is troublesome, it is more convenient for people like me who are new to development and learning ~)
:

1. A new dll project is recommended. A Log class is added and a static Write method is provided to Write information to a file. A strong signature file is generated and added to GAC.
The sample code is as follows: public class Log
{
Private static string m_file = @ "C: \ Temp \ info.txt ";
Private static FileStream fs = new FileStream (m_file, FileMode. OpenOrCreate, FileAccess. ReadWrite, FileShare. ReadWrite );

Public static void Write (string Message)
{
Fs. Seek (0, SeekOrigin. End );
Message + = "\ r \ n ";
Byte [] buffer = Encoding. ASCII. GetBytes (Message );
Fs. Write (buffer, 0, buffer. Length );
Fs. Flush ();
}

2. Add this dll reference to Biztalk projects with business processes.
Add an "expression" (for example) to the place where you want to record it. Enter the following code in its property-> expression:
Namespace. Log. Write (Message );
Replace Namespace with the actual Namespace of the above Log class, and the Message will write the information you want to write to the file.

3. Compile and deploy. test :)
If it is normal, then you will see an info.txt file under the expected stage, which records the actual running path of your business process.
Through this simple method, you can easily know that there is a problem with this business process ~
You don't need to use "running status and activity tracking" to view it first (lest the system is too slow to wait)

Scott Colestock wrote an article about how to use Log4Net in BizTalk to track the process running status.
If you are interested, read this article:
Diagnostic Tracing with BizTalk 2004
Ps, this guy has a project that uses Nant to Deploy Biztalk 2004 Solution :). It feels quite fun ~

Summary: in fact, this is very simple, that is, we use the. NET support of BizTalk 2004. We can call all. NET static methods in the "expression...

Khan, I always feel that I haven't published any technical articles :(

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.