611
Views
8
Comments
How to audit from an extension?
Question
Does anyone knows how to audit from an extension?

Thank you.
2020-03-19 14-14-27
Pedro Gonçalves
Staff
Hi Mário,

You can simply use this statement: GenericExtendedActions.Audit(AppInfo.GetAppInfo().OsContext, "AUDIT MESSAGE", "MODULENAME");

I believe someone else has published a more detailed post about this...but can't find it. So, here's the straight answer, anyway.

Cheers,

Pedro Gonçalves
2018-05-09 15-40-27
Pedro Oliveira
Staff
I've been searching for how to log the errors of an extension I'm working on a this partially solves my problems.

The issue is: What if want to log an exception into the error log and not the general log?

This is where it really belongs in terms of semantics and its where I need to place it.

Thanks in advance for your support.

All the best,
Pedro Oliveira
2020-03-05 15-52-45
André Vieira
Staff
Hi Pedro,

This is an undocumented feature but you can use:

using OutSystems.HubEdition.RuntimePlatform.Log; ...
private void LogError(Exception e) {
ErrorLog.StaticWrite(DateTime.Now, AppInfo.GetAppInfo().OsContext.Session.SessionID,
AppInfo.GetAppInfo().eSpaceId, AppInfo.GetAppInfo().Tenant.Id,
AppInfo.GetAppInfo().OsContext.Session.UserId, e.Message, e.ToString(), "My Message here");
}

I hope this helps you.
Cheers,
André
2018-05-09 15-40-27
Pedro Oliveira
Staff
Thanks André!

This does work as expected. I will use this in my extension.

All the best,
Pedro
2024-01-22 15-21-29
Pedro Cardoso
If you're wondering how to use the GenericExtendedActions it in java.... here it goes

GenericExtendedActions.audit(AppInfo.getAppInfo().getOsContext(), "AUDIT MESSAGE", "MODULENAME");
2025-08-22 10-19-44
Pramod Jain
 
MVP

After so long i need to use this ..thanks i found it easily here.

2025-01-17 13-16-27
Igor Kirtak

In version 10, GenericExtendedActions.Audit() is marked as obsolete, and description suggests to use LogMessage(). So I have changed to GenericExtendedActions.LogMessage() - but this doesn't log anything! At least not in service center General logs. I have changed back to Audit(). Is this a bug?

2014-07-01 01-00-59
Miguel Oliveira

My using version 10.0.828.0 and used GenericExtendedActions.LogMessage() and it logs the messages in the Service Center General Log. I believe this is no longer an issue. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.