Answered by:
Export the Biztalk error to a file from the Biztalk project.

Question
-
Hi,
I have created console app in VS 2012 to export the biztalk errors from Event Viewer to a text file.
Here i have used eventlog class to fetch the application log errors on click of .Exe file it will generate the the text file.
So I need to integrate this .exe or .net code to Biztalk project. How can i integrate this one. Any idea on this - how can i achieve this.
Biztalk handles error but i need to export that biztalk error which occured in the application in to seperate text file in a location. Because each time user needs to go to Adminstrative console then to EventViewer->Windows log->Application - > to view the Biztalk error. In this case i need to export the errors to a text file from the project instead of going to view error in Admin Console. i need some code samples on how to make it.
But in .net we can achieve it using EventLog class to export the event viewer appplication log to a text file.As i said in first Earlier.Whether it can be integrate in to biztalk project through Custom Pipeline or any other way.Monday, August 25, 2014 10:13 AM
Answers
-
Sounds like you don't want to events log and pull BizTalk related errors.. etc etc.
We had a similar requirement, what I did was set enable routing of failed messages on receive and send ports. For Orchestration, I catch them in Exception block and promote, ErrorReport properties to context using co-relation.
After that have another orchestration which subscribes to all such messages (ones with Error properties avalaible) and then load them to SQL database, where they stay for 2 months (can be changed). That way you can query errors easily based on application name, error date, errordescription etc.
the table looks something like this:
Thanks
Tuesday, August 26, 2014 3:17 AM
All replies
-
This can be done by incorporating the System.Diagnostics.Trace (as opposed to System.Diagnostics.EventLog) for the purpose of orchestration and debugging. Have a look at http://msdn.microsoft.com/en-us/library/cc825581(v=bts.10).aspx - While it say BizTalk Server 2006 the section - Using Debug and Trace Statements in an Orchestration is relevant to any version of BizTalk.
You will be able to create orchestration specific Trace Files, the levels of tracing can be configured and the trace files shared with whoever has to have a look.
Regards.
Monday, August 25, 2014 10:29 AM -
Why do you need to integrate this code into a BizTalk app?
If all you need to do is export entries from the Event Log, run that program as a scheduled task and write the results somewhere the other use can access.
Monday, August 25, 2014 11:33 AMModerator -
Hi,
Another option is use the BizTalk CAT Instrumentation Framework in your Orchestrations. It’s is a high performance tracing/logging framework for BizTalk that builds upon the Event Tracing for Windows (ETW) infrastructure. You can use it in combination with the BizTalk CAT Instrumentation Framework Controller. That is an easy-to-use GUI for the BizTalk CAT Instrumentation Framework. The Controller lets you start and stop a trace and adjust filter options. It can easily enable real-time tracing to Microsoft SysInternals DebugView , to a log file or to both at the same time.
Best Practices for Instrumenting High Performance BizTalk Solutions
http://blogs.msdn.com/b/asgisv/archive/2010/05/11/best-practices-for-instrumenting-high-performance-biztalk-solutions.aspx
BizTalk CAT Instrumentation Framework Controller
https://btscatifcontroller.codeplex.com/Kind regards,
Tomasso Groenendijk
Blog | Twitter
MCTS BizTalk Server 2006, 2010If this answers your question please mark it accordingly
Monday, August 25, 2014 11:51 AM -
Hi Vijayan,
What is the objective of your requirement? Is this just to save user from going through Administrative console à EventViewer->Windows log->Application - > Filter event for BizTalk error?
In this case you can create a custom event log for BizTalk and hold the events related to BizTalk in one node/category. So you’re users can directly to eventlog for Biztalk error. (FYI event log can be access without going through BizTalk admin console). So users can view information/warning/error specific to BizTalk in one view
EventVieweràCustom viewàBizTalk.
No automated steps required, just a simple one off configuration would do the trick. Read the following article on step-by-step guidance on achieving the same.
Creating a custom event log under Event Viewer to log server events
Or is requirement is due to some access issues you want to accumulate/consolidate all the BizTalk errors into one place so user can see BizTalk evenlog info in one place like a text file in a shared location, then the following article can help you to achieve the same.
But what do you mean by integrate above process in to BizTalk. When you mean by “Biztalk handles error but i need to export that biztalk error which occured in the application in to seperate text file in a location”, are you looking to log the BizTalk “application” error/events i.e logging from your applications in BizTalk to a log file ? Then you can consider about using standard logging library like Enterprise Library Logging block, or NLog, or log4net. log4net can fit well comparing other logging framework.
Following references can help you on this context:
Write log file for Biztalk Logging with log4net – Sample
Biztalk and Logging with log4net
But keep in mind that this is application logging, i.e. logging from your BizTalk applications like logging while processing the message in pipeline/orchestration. But this will not log when one of the send port/receive location is stopped. These information are logged into eventlog.
If you’re looking for application level logging then also know about BizTalk CAT Instrumentation Framework Controller.
Or if you want to your existing console application which exports the eventlog to text file to be automated, then use the Windows schedule task to run your console application periodically and let it export the errors to text file. You can console the export process in such a way that it can export the eventlog entries for the last one hour if you can configure the Windows schedule task to run every one hour to export the logs to text file.
I have given various options, hope you can choose the one which suits your need best.
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.
- Edited by M.R.Ashwin Prabhu Monday, August 25, 2014 12:05 PM
Monday, August 25, 2014 12:05 PM -
Hi
Thanks for your reply.
The above reference link which tells about the Debug and Trace options in an Orchestration.
But i need to export all errors occured in biztalk project inside orchestration/pipeline/map from receive port to send port to a text file. How can we acheive this.
Thanks.
Monday, August 25, 2014 2:05 PM -
What ever you log into the Event Viewer can be logged into the Trace File. So if you get you components to use a specific Trace File (as is given on the page, the filename is derived from the Executing Assembly) and then all you need to do is collate the trace output.
Regards.
Monday, August 25, 2014 2:24 PM -
If you already have a program to do this, why exactly are you asking?
As an aside, have you looked into BizTalk 360?
Monday, August 25, 2014 3:18 PMModerator -
Sounds like you don't want to events log and pull BizTalk related errors.. etc etc.
We had a similar requirement, what I did was set enable routing of failed messages on receive and send ports. For Orchestration, I catch them in Exception block and promote, ErrorReport properties to context using co-relation.
After that have another orchestration which subscribes to all such messages (ones with Error properties avalaible) and then load them to SQL database, where they stay for 2 months (can be changed). That way you can query errors easily based on application name, error date, errordescription etc.
the table looks something like this:
Thanks
Tuesday, August 26, 2014 3:17 AM