Hi All,

I was checking how logs are created in outsystems and what I could understand is below types of logs are generated.

  • Errors
  • General logs
  • Web requests
  • Mobile requests
  • Service Actions
  • Integrations
  • Extensions
  • Timers
  • Emails.

My concern is that, all the activities wrt application should be logged sequentially(eg someone logged in, someone using the application, error occurred, log out, etc ). Major interest to have logs regarding login and logout, who is using the application. Please let me know how can get these information/any addition setup required.


Regards,

Ankita


Hi Ankita,


You can use LogMessage to further extend the auto generated logs by the platform.
They would be placed under the section 'General', with a Module name you can specify, that way you can place them wherever you need.

Cheers,
André

Ankita Kulkarni wrote:

Hi All,

I was checking how logs are created in outsystems and what I could understand is below types of logs are generated.

  • Errors
  • General logs
  • Web requests
  • Mobile requests
  • Service Actions
  • Integrations
  • Extensions
  • Timers
  • Emails.

My concern is that, all the activities wrt application should be logged sequentially(eg someone logged in, someone using the application, error occurred, log out, etc ). Major interest to have logs regarding login and logout, who is using the application. Please let me know how can get these information/any addition setup required.


Regards,

Ankita



Hi Ankita,


As André mentioned, you can use the LogMessage Server action to log additional messages in, for example, your login/logout flow.


Just add it in both flows and it will log the message for you everytime someone logs in or logs out. 


Remember that someone can also end their session by just closing the app or the browser and no logout will be performed.

Bas de Jong wrote:

Ankita Kulkarni wrote:

Hi All,

I was checking how logs are created in outsystems and what I could understand is below types of logs are generated.

  • Errors
  • General logs
  • Web requests
  • Mobile requests
  • Service Actions
  • Integrations
  • Extensions
  • Timers
  • Emails.

My concern is that, all the activities wrt application should be logged sequentially(eg someone logged in, someone using the application, error occurred, log out, etc ). Major interest to have logs regarding login and logout, who is using the application. Please let me know how can get these information/any addition setup required.


Regards,

Ankita



Hi Ankita,


As André mentioned, you can use the LogMessage Server action to log additional messages in, for example, your login/logout flow.


Just add it in both flows and it will log the message for you everytime someone logs in or logs out. 


Remember that someone can also end their session by just closing the app or the browser and no logout will be performed.

Hi Bas de Jong,

Thank you for the inform.

Your last point is completely valid. In this case is there any other way we can achieve the log once the app is closed.(something similar to closing of app should trigger logout action?)


Ankita Kulkarni wrote:

Bas de Jong wrote:

Ankita Kulkarni wrote:

Hi All,

I was checking how logs are created in outsystems and what I could understand is below types of logs are generated.

  • Errors
  • General logs
  • Web requests
  • Mobile requests
  • Service Actions
  • Integrations
  • Extensions
  • Timers
  • Emails.

My concern is that, all the activities wrt application should be logged sequentially(eg someone logged in, someone using the application, error occurred, log out, etc ). Major interest to have logs regarding login and logout, who is using the application. Please let me know how can get these information/any addition setup required.


Regards,

Ankita



Hi Ankita,


As André mentioned, you can use the LogMessage Server action to log additional messages in, for example, your login/logout flow.


Just add it in both flows and it will log the message for you everytime someone logs in or logs out. 


Remember that someone can also end their session by just closing the app or the browser and no logout will be performed.

Hi Bas de Jong,

Thank you for the inform.

Your last point is completely valid. In this case is there any other way we can achieve the log once the app is closed.(something similar to closing of app should trigger logout action?)


Hi Ankita,


You can try to place a javascript to detect the event of closing the browser and then you can associate a button that will be clicked and run a server action to log it.

Check this:

https://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event


Kind regards,

Hugo


Hugo Antunes wrote:

Ankita Kulkarni wrote:

Bas de Jong wrote:

Ankita Kulkarni wrote:

Hi All,

I was checking how logs are created in outsystems and what I could understand is below types of logs are generated.

  • Errors
  • General logs
  • Web requests
  • Mobile requests
  • Service Actions
  • Integrations
  • Extensions
  • Timers
  • Emails.

My concern is that, all the activities wrt application should be logged sequentially(eg someone logged in, someone using the application, error occurred, log out, etc ). Major interest to have logs regarding login and logout, who is using the application. Please let me know how can get these information/any addition setup required.


Regards,

Ankita



Hi Ankita,


As André mentioned, you can use the LogMessage Server action to log additional messages in, for example, your login/logout flow.


Just add it in both flows and it will log the message for you everytime someone logs in or logs out. 


Remember that someone can also end their session by just closing the app or the browser and no logout will be performed.

Hi Bas de Jong,

Thank you for the inform.

Your last point is completely valid. In this case is there any other way we can achieve the log once the app is closed.(something similar to closing of app should trigger logout action?)


Hi Ankita,


You can try to place a javascript to detect the event of closing the browser and then you can associate a button that will be clicked and run a server action to log it.

Check this:

https://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event


Kind regards,

Hugo


Hi Hugo,

Thank you. Will definitely try this. 


Can I ask why do you need to know if a user is logged in or out? 

Cheers. 

Eduardo Jauch wrote:

Can I ask why do you need to know if a user is logged in or out? 

Cheers. 

Hi Eduardo Jauch,

I want to know when and which user logged in and out for audit purpose as we are building an application which has very limited users and which will be used within the enterprise itself. We need to know this to keep track of the activities and log them for auditing  


Hi All,

I have tried all as suggested, our requirement is little changed.

We need to log all the actions as the user who has logged in. For example, which user has created the  record and which user has deleted the record... all the actions as part of security.


Please help me with this.

Thank you

Ankita Kulkarni wrote:

Hi All,

I have tried all as suggested, our requirement is little changed.

We need to log all the actions as the user who has logged in. For example, which user has created the  record and which user has deleted the record... all the actions as part of security.


Please help me with this.

Thank you

Record created -> Add an extra attribute to the database to store the UserId. Use GetUserId() to retrieve the ID of the currently logged in user

If a user has deleted a record, you can choose to set the record as inactive using a boolean (So it appears as deleted but it is still present in the database). Then you can log the userId as the same way i described in the created step.


Good luck.


Hello Ankita,

There is NO automatic way (built-in) of log every action of a user.
So, you need to implement the logic yourself.

As a suggestion, isolate your entities in core modules set to Expose Read Only to Yes/True, create "wrappers" (public server actions) for your entities to realize the CRUD operations. This way, any operation in the database will have to pass through those wrappers.

In them, you can create code to automatically log who is performing what in the records.

The way to save this information may be different, depending on your requirements. You can do as Bas suggested, or you can create a Log entity (and maybe some auxiliar static entities to keep track of operation type and entity), and save the log to it, or you can log into the system what was done and by who in the log system of the platform, like suggested previously by André.

Some links on wrappers: 

https://medium.com/@jmjames/outsystems-crud-wrapper-basics-e9a577a3e044

https://medium.com/@jmjames/laying-the-foundation-for-outsystems-crud-wrappers-7293329e2252

https://medium.com/@jmjames/outsystems-crud-wrapper-checklist-c7efb2ad9115

Hope this helps.

Cheers.