Is it possible to use the System Event Log for logging custom events?

Hi community,

the system event log by default is configured so we can track successful and failed login attempts. I wonder if we can also use the log to track other events of interest?

E.g. I have a few C# Methods where I want to track when and how often the Methods fails.

I have added a custom SystemEvent type for "MethodFailed". But when I use the following code, I will get the following error message: "Requested value "MethodFailed" was not found.

CCO.SystemEventLogger.CreateSystemLogRecord("MethodFailed","Method_doSomething",inn.getUserID(),"Method xy failed, value z invalid" );

This line of code in a C# Method only works, when I use one of the standard OOTB system events:

CCO.SystemEventLogger.CreateSystemLogRecord("SuccessfulLogin","Method_doSomething",inn.getUserID(),"Method xy failed, value z invalid" );

Is it possible to use own system events types at all? If yes, where do I have to add my custom event type?

Or maybe someone know some other log options? I don´t want to build a separate ItemType for this use case. The System Event log would fit very well, cause it is checked and cleared on a regular basis anyway.

Would be cool if somebody has an idea how to solve this one!

  • Hi Angela,

    I had to look at the source code for this function, but it looks like the supported list of event types are hard-coded. The hard-coded list does contain all of the standard server events (onAfterAdd, onBeforePromote, etc.) as well as the system events (SuccessfulLogin, FailedLogin, Logout). While you can't use custom events, if the method you're interested in is called in one of the standard server events, it might make sense use that event in place of a custom MethodFailed event. Something like:

    CCO.SystemEventLogger.CreateSystemLogRecord("OnAfterAdd","Method_doSomething",inn.getUserID(),"Method xy failed, value z invalid" );

    Note that these event names are case-sensitive and written in PascalCase (capital first letter and capital letters on every distinct word).

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

  • Hi Chris,

    Pascal-Notation? Sounds like this is one something very historic from the early days of Innovator.

    I tested a variant with 'OnBeforeAdd' and can confirm that your solutions works well! In the end I mainly was looking for an event type that I can use for filtering the custom events more easily. It doesn´t matter if we call it 'MethodFailed' or 'OnAfterWhatever'. So this one fits the jobs perfectly. Thanks for this easy and quick solution!

  • Hello Chris/ Angela,

    When user directly closed the browser instead of log out. In that case LogOut system event will call or not after session end for that user?

    If I want to generate the user working hours based on Login log out then thru system event is it possible? 


    Regards,

    Suhas 

  • Hi Suhas,

    I'm not very experienced with these kinds of System Events. I'd recommend following Angela's approach here and printing out a log record from your LogOut event. You can then try closing the browser instead of logging out to see if the log is generated. If that doesn't work, I'd recommend making a new forum post to ask this question in order to make it more visible to the rest of the community. 

    Chris

  • Hi Chris,

    Thanks for reply. 

    I have checked, if I'm closing browser directly then event is not trigger even after session time out.

    Regards,

    Suhas