Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Enterprise Tools / July 2004

Tip: Looking for answers? Try searching our database.

XSLT Formatters for Logging Block V2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Enrico - 15 Jul 2004 08:29 GMT
Hello,

I've successfully got
CMAB
EMAB
EIF
And the logging block all working together! YAY!

All I need now is to know how to use the XSLTs, i.e how do I set up
the config files? I've read the relevent documentation and am still
confused.

For example if in the EnterpriseInstrumentation.config file I have:

----Start insert----

<eventSink name="logSink" description="Outputs events to the Windows
Event Log." type="Microsoft.EnterpriseInstrumentation.EventSinks.LogEventSink">
     <parameter name="entryTypeFieldName" value="EventLogEntryTypeID"
/>
     <parameter name="defaultEntryType" value="Information" />
     <parameter name="machineName" value="." />
   </eventSink>

----End insert----

Then my application logs to the event log in the following format:

----Start insert----

Microsoft.ApplicationBlocks.Logging.Schema.ErrorMessageEvent
{
  String Message = "ErrorMessageEvent"
  String ErrorCode = ""
  Int32 Severity = 2
  Int32 ProcessID = 3888
  String ProcessName = "WinUI.exe"
  String ThreadName = ""
  ComPlusInfo ComPlus = {
     String ActivityID = ""
     String ApplicationID = ""
     String TransactionID = ""
     String DirectCaller = ""
     String OriginalCaller = ""
  }
  WindowsSecurityInfo WindowsSecurity = {
     String CurrentAccountName = "HYDROGEN\Administrator"
     String ProcessAccountName = "BUILTIN\Administrators"
  }

----End insert----

However I want to be able to make use of the loglevel ability and this
only works if I do the following in the
EnterpriseInstrumentation.config file

----Start insert----

<eventSink name="logSink" description="Outputs events to the Windows
Event Log." type="Microsoft.ApplicationBlocks.Logging.EventSinks.LogEventSink,
Microsoft.ApplicationBlocks.Logging.EventSinks, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxx">
        <parameter name="entryTypeFieldName" value="EventLogEntryTypeID" />
        <parameter name="defaultEntryType" value="Information" />
        <parameter name="enableFormatting" value="true" />
        <parameter name="machineName" value="." />
        <parameter name="formatterName" value="logSinkXslt" />
       
   </eventSink>

----End insert----

However when I do this the messages in the event log looks like so:

----Start insert----

<LogData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Property
name="id" value="af453fc1-1529-4b4f-9bf3-d98e36299668"></Property><Property
name="type" value="Microsoft.ApplicationBlocks.Logging.Schema.ErrorMessageEvent"></Property><Property
name="Message" value="&#xD;&#xA;General Information
&#xD;&#xA;*********************************************&#xD;&#xA;Additional
Info:&#xD;&#xA;severity: 19&#xD;&#xA;errCode:
LOGON:1000&#xD;&#xA;ExceptionManager.MachineName:

----End insert----

What am I doing wrong?
[MSFT] - 15 Jul 2004 10:07 GMT
Hello,

I am not sure if I have understood the problem. Is it the problem  that
logability didn't work? Or you wonder how to control the log information
format with XSLT? In Logging block quick start samples, there is one named
"formatting sample", you may refer to it for the formatting.

Luke
Enrico - 16 Jul 2004 03:02 GMT
> Hello,
>
[quoted text clipped - 4 lines]
>
> Luke

Logging to the event log is fine. The problem is the event being
logged rather than being formatted nicely (i.e. plain text) it is
being logged as XML.

So my question is how do I make all my events get logged as plain text
while retaining the functionality of the loglevel sample.
[MSFT] - 16 Jul 2004 08:32 GMT
I think you need to create a customized formatter here, which inherits from
IEventFormatter. In App.config. you may check the <eventformatingSettings>
element, all format are specified here, and used in:

<parameter name="formatterName" value="logSinkXslt" />

Luke
Enrico - 19 Jul 2004 03:55 GMT
Hello,

Thanx for your tip, do you have any documentation on creating such
formatters which inherit from
Microsoft.ApplicationBlocks.Logging.EventSinks.IEventFormatter?

Is there there also a need to create new xslt files too?

> I think you need to create a customized formatter here, which inherits from
> IEventFormatter. In App.config. you may check the <eventformatingSettings>
[quoted text clipped - 3 lines]
>
> Luke
[MSFT] - 19 Jul 2004 07:43 GMT
After more research on this topic, I have to correct myself for my previous
message. When I said "you need to create a customized formatter", it is not
right. In fact, we can create a customized formatter, we also can stay with
"LogSinkXslt" and create new customized XSLT file. I suggest you may take a
look at FormattingSample in Logging applicaiton block quick start samples.
It introduces how create and specify a customized XSLT file in the project.
The XSLT file is very simple, you may modify it to see if it can work for
your issue.

Luke

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.