SLAB confusing tasks and events

Topics: Semantic Logging Application Block
Nov 14, 2013 at 9:39 PM
I'm having a problem when I try to use tasks in my EventSource. When it creates the manifest, it seems to be mixing tasks and events, and when my log comes out, any event with a task seems to have its eventname set to its taskname.

For example, if I add a Tasks nested class like:
    public class Tasks
        {
            public const EventTask Timing = (EventTask)1;
            public const EventTask MethodResults = (EventTask)2;
            public const EventTask ADDataGathering = (EventTask)3;
            public const EventTask ArtDataGathering = (EventTask)4;
            public const EventTask MethodFail = (EventTask)5;
            public const EventTask Error = (EventTask)5;


        }
when it translates to the manifest, it looks like
 <tasks>
  <task name="Timing" value="1"/>
  <task name="MethodResults" value="2"/>
  <task name="ADDataGathering" value="3"/>
  <task name="ArtDataGathering" value="4"/>
  <task name="Error" value="5"/>
  <task name="Error" value="65034"/>
  <task name="UpdateAllPersonKeys" value="65225"/>
  <task name="UpdateAllPersonKeys_CASUserNotFoundInPersonCache" value="65226"/>
  <task name="LoginSuccess" value="65227"/>
  <task name="Login_UserNotAuthenticated" value="65228"/>
  <task name="Login_UserNotInApp" value="65229"/>
  <task name="Login_UserNotFound" value="65230"/>
  <task name="LoginAttempt" value="65231"/>
  <task name="Login_ApplicationNotFound" value="65232"/>
  <task name="GetUser_UserMembershipNotFound" value="65233"/>
  <task name="GetSettings_ApplicationCodeNotFound" value="65332"/>
  <task name="GetSettings" value="65333"/>
  <task name="GetPersonByLoginId_PersonNotFound" value="65429"/>
  <task name="GetPersonByLoginId" value="65430"/>
  <task name="GetPersonByPersonKey_PersonNotFound" value="65431"/>
  <task name="GetPersonByPersonKey" value="65432"/>
  <task name="GetPeople" value="65433"/>
  <task name="GetAllPeople" value="65434"/>
  <task name="SessionEnded" value="65526"/>
  <task name="SessionStarted" value="65527"/>
  <task name="ApplicationEnded" value="65528"/>
  <task name="ApplicationStarted" value="65529"/>
  <task name="CodeSectionEnd" value="65530"/>
  <task name="CodeSectionStart" value="65531"/>
  <task name="MethodEnd" value="65532"/>
  <task name="MethodStart" value="65533"/>
 </tasks>
where all the task names in the 65000s are really event names.

I also noticed that in the manifest, there is no event name, but the event name is stored in the task attribute.

Then the json formatter generates a packet like
{
  "ProviderId": "136482aa-15a4-5164-2a41-0d65081164f2",
  "EventId": 1,
  "Keywords": 0,
  "Level": 5,
  "Message": "MethodStart : CASSPersonInfoService.GetPersonByLoginId ",
  "Opcode": 0,
  "Task": 1,
  "Version": 0,
  "Payload": {
    "methodName": "CASSPersonInfoService.GetPersonByLoginId",
    "additionalDetails": ""
  },
  "EventName": "TimingInfo",
  "Timestamp": "2013-11-14T21:37:56.6738070Z"
},
Where the eventName is actually the task name, not the event name
Nov 17, 2013 at 5:00 AM
The EventName is set by the block to be the TaskName concatenated with the OpcodeName. The EventName is used by the EventTextFormatter and the JsonEventTextFormatter in outputting the formatted message..

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Nov 18, 2013 at 7:27 PM
That's unfortunate. I want the event method name to be the event name, and the task to be separate, so I can do grouping of like tasks that way. Oh well, otherwise, its looking good. I have another issue, but I'll start another thread.
Dec 19, 2014 at 9:33 PM
I have to agree that this is unfortunately. We were really hoping the Task and Opcode could be used as further discriminators of events, in addition to the EventName. Combining them in this way is limiting.