OutSystems Platform — Auditing 101 — Part III

João Heleno
2 min readJul 16, 2020

--

Welcome to part III of a series of articles on how to use audit actions with the OutSystems Platform.

In the previous articles, we saw how to use the LogMessage system action and the AsynchronousLogging API. If they are new to you I invite you to read Part I and Part II.

This time I will focus on extensions and how to create audits from your custom .NET components.

Debugging extensions can be a bit tricky and in more complex scenarios it might require access to the server running IIS and the OutSystems Platform.

For simple scenarios, a few audits might do the trick!

Add the propper OutSystems platform namespace

Make sure your source code file is using the Outsystems.Hubedition.RuntimePlatform namespace.
If you just created an extension with Integration Studio, the default source files will have this already. Otherwise, if you are adding your own source files make sure you have the appropriate include directive.

Using directive in Visual Studio

Calling the LogMessage method

To log a message, invoke the method LogMessage from the GenericExtendedActions class.

Calling LogMessage in Visual Studio

This method receives three parameters:

  • Context: platform runtime context property to be used during the request processing. Use AppInfo.GetAppInfo().OsContext to get it;
  • Message: the message you want to log;
  • Module: the module name to appear in Service Center.

Accessing the audit messages

After having the audits in place in your extension(s), access Service Center to check the messages.

They will be available in the General Log tab under Monitoring.

Service Center General Log

Notes

  • There is a limit of 3000 entries in the same web request when using the LogMessage method.
  • There is a deprecated older method named Audit with the same input parameters. You should use LogMessage instead.
  • You can also access the audits in your application by referencing the Log_General entity available in the PlatformLogs module. Filter them using the Module_Name attribute. Looking at the previous example, the module name is “ACME”.

For more details or questions leave me a message at the OutSystems Community Forums.

Specials thanks to Kilian Hekhuis for proofreading the article.

--

--

João Heleno

Senior Consultant @ IG&H Platform Services | OutSystems MVP