KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Log Specific Client Actions in Server Logs
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: August 23, 2021

Sometimes in a client/server environment, you may want to know when a specific action is performed on client machines. You can do this by logging client actions into server-side logs. This way, you can see all the users that performed the action and when they performed it, all in one place.

For example, say you want to log which client starts a certain procedure and when they do it.

To do this,

  1. First start the log recording on the server. You can begin running the server-side diagnostic logs by executing this on the server.

  2. SET DATABASE PARAMETER(Diagnostic log recording;1)

  3. Create a method named ClientActionToServerLog with the 'Execute on Server' property checkmarked.

  4. In the method, include the following code to record the user and their action into the server-side diagnostic log.

  5. //METHOD Name = ClientActionToServerLog
    //ATRIBUTES = Execute on Server

    C_TEXT($user)
    $user:=Current user
    LOG EVENT(Into 4D diagnostic log;$user+" - STARTED SPECIFIC TASK";Information message)

  6. Call this method before the code that starts the task. You can call this method before any action that you may want to keep track of. This will log any information you want into the server-side log because it is executed on the server