Trace.SetServerLogPath
----------------------

Enables logging per thread for server.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Trace](component_Trace.md) | [10.4](newinversion104.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Trace.SetServerLogPath"; Path ) 

**MBS**( **"Trace.SetServerLogPath";** /\* Enables logging per thread for server. \*/  
**$Path**) /\* The native folder path.e.g. "/tmp" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native folder path. | "/tmp" |

### Result

Returns OK or error.

### Description

Enables logging per thread for server.  
Only useful on server, where multiple scripts may run in parallel and each may log to its own file.  
We suggest to use /tmp folder as this gets cleaned on server restart, but FileMaker's log folder may also work.  
Does nothing if called on client.  
  
Be aware that FileMaker Server reuses threads and the logs append the files, so when a script is done, the log file gets reused for another script.  
  
See also [Trace.SetWithTimes](TraceSetWithTimes.md) to enable times in trace log.  
Since this function also enables trace if not yet running, there is no need to call Trace function.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Set tmp as log folder:

 Set Variable \[ $r ; Value: MBS ( "Trace.SetServerLogPath"; "/tmp" ) \]  
Log to FileMaker's log folder on a Linux server:

 MBS ( "Trace.SetServerLogPath"; "/opt/FileMaker/FileMaker Server/Logs/")  
Enables logging on Windows Server:

 Set Variable \[ $r ; Value: MBS ( "Trace.SetServerLogPath"; "C:\\Program Files\\FileMaker\\FileMaker Server\\Logs\\\\") \]  
Setup logging on server with multiple log files and times:

 Set Variable \[ $r ; Value: MBS ( "[Trace.SetWithTimes](TraceSetWithTimes.md)"; 1) \]  
Set Variable \[ $r ; Value: MBS ( "Trace.SetServerLogPath"; "/Library/FileMaker Server/Logs/") \]  
Set Variable \[ $r ; Value: MBS ( "Trace") \]  
### See also

- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [Trace](Trace.md)
- [Trace.GetServerLogPath](TraceGetServerLogPath.md)
- [Trace.SetWithTimes](TraceSetWithTimes.md)

### Release notes

- **Version 10.4**
    - Added [Trace.GetServerLogPath](https://www.mbsplugins.eu/TraceGetServerLogPath.shtml) and [Trace.SetServerLogPath](https://www.mbsplugins.eu/TraceSetServerLogPath.shtml) functions. Allows to have one trace log file per thread.

### Blog Entries

- [Watching for Errors with MBS Plugin](https://www.mbsplugins.de/archive/2021-03-18/Watching_for_Errors_with_MBS_P/monkeybreadsoftware_blog_filemaker)
- [What is new in the MBS FileMaker Plugin Version 10.4](https://www.mbsplugins.de/archive/2020-09-22/What_is_new_in_the_MBS_FileMak/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 10.4](https://www.mbsplugins.de/archive/2020-09-15/Neues_MBS_FileMaker_Plugin_104/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 10.4 - More than 6300 Functions In One Plugin](https://www.mbsplugins.de/archive/2020-09-15/MBS_FileMaker_Plugin_104_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.4pr7](https://www.mbsplugins.de/archive/2020-09-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Socket changes for MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2020-08-31/Socket_changes_for_MBS_FileMak/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 31st August 2020 , last changed 9th September 2021

  
[Trace.SetErrorsOnly](TraceSetErrorsOnly.md) - [Trace.SetWithTimes](TraceSetWithTimes.md)

[HTML Version](TraceSetServerLogPath.shtml)