General development tasks

Sending data from a plug-in to a log file

Call the log() function of the IFmsServerContext class in a plug‑in to send custom messages to log files from the Authorization and File plug-ins. Plug‑in log files are located in the RootInstall/logs directory and are named fileio.NN.log and authMessage.NN.log, by default.


In addition to client connections, the Authorization plug‑in logs the connections made when a server-side method is called. These connections are distinguished by the IP address in the access.log files and in the authEvent.log files.

The log() function has an argument that specifies whether the log message should also be logged to the system log (Windows Event Viewer or Linux syslog). The default value is false. Excessive logging to the system log can cause performance problems.

Edit the Logging section of the Server.xml configuration file (located in RootInstall/conf) to enable or disable each log file. Edit the Logger.xml file (located in RootInstall/conf) to add or change the configuration information, including the location and name of the log files. For detailed information, see the comments in the XML files.

The Access plug-in is hosted by a process that closes standard out and standard error, therefore plug-in developers cannot rely on these to log messages. Instead, for the Access plug-in, log messages explicitly to a file. The sample Access plug-in demonstrates a workaround. Search for the line FILE* logFile = fopen("SampleAdaptor.log", "a"); in the RootInstall/samples/plugins/access/adaptor.cpp file.

Retrieving data from a configuration file

Call the getConfig() function of the IFmsServerContext class in an Authorization plug‑in or a File plug‑in to retrieve custom data stored in the Server.xml configuration file. You can analyze this data in the plug‑in to activate different functionality in the plug‑in, depending on the server configuration.

Plug‑ins can retrieve data stored in the Plugins XML element. To add custom data, open the Server.xml file (located in the RootInstall\conf folder) in a text editor and add data. Verify the XML and restart the server.

Calls to getConfig() can get only text node values. Calls to the method cannot get values added as attributes to elements, multiple elements, or nested elements.

For an example of a call to IFmsServerContext->getConfig(), see the AuthModule.cpp file.

Handling time-critical calls

Every call from the server to a File or Authorization plug‑in—for example, authorize() in the Authorization plug‑in—is time-critical. A call should be processed and returned back to the server as fast as possible, because the server remains in a pending state until the call is returned. If processing the call is time consuming and requires a wait or sleep operation, the passed arguments should be preserved and passed to a thread pool that is created by the plug‑in. For an example, see the FileModule sample.

Adobe logo

Sign in to your account