Including the Log File with the Data Download Results

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2020.0

Introduction

When using the Data Download service in FME Server, additional files can be added. In this tutorial, we will add the FME Server job log with our download, which requires the FMEServerLogFileRetriever transformer. To add other files, please follow the Including additional files in the data download result zip file tutorial.

 

Step-By-Step Instructions

1. Open Template Workspace

In FME Workbench, open the Download_Logfile-Begin.fmwt workspace. This workspace writes a test message into a text file.

 

2. Add a FMEServerLogFileRetriever transformer

Now add an FMEServerLogFileRetriever transformer to the canvas and connect it to the Creator transformer.

logfileretriever.jpg

 

In the parameters, set the Connection to your FME Server connection.

 

Then set the Job ID to the FME Server Job ID Parameter $(FME_JOB_ID). The parameter can be selected by clicking on the drop-down next to Job ID then going to User Parameter > FME Server Parameters > FME_JOB_ID.

selectjob.jpg

 

Finally, change the Output Log Attribute to text_line_data. We need to change this attribute so that our writer in the next step will be able to read it. Click OK to save the parameters.

 

3. Add a Text File Writer

Now that the log file has been retrieved, we need to write it out. Add a Text File writer to the canvas. For the Dataset, browse to where you would like it to be saved, then name it job.txt, we will modify the filename in the next step.

writer.jpg

 

Once the Text File writer is added to the canvas, connect it to the FMEServerLogFileRetriever transformer.

 

4. Create Fanout

When the workspace runs on FME Server, the data download file will contain the job.txt. Job.txt is not a very descriptive name, we can update this to include the log number and change the file extension to be .log.

 

In the Navigator window, expand the job [TEXTLINE] writer. Then double-click on Fanout.

navigatorwindow.jpg

 

In the Edit Job [TEXTLINE] dialog, enable Fanout Expression, then set the Fanout Expression to:

job_$(FME_JOB_ID).log

fanoutexpression.jpg

 

Now the file will be named job_1234.log or whatever number the current job is.

 

5. Save and Publish to FME Server

Save the workspace, then publish it to FME Server. When registering for services, ensure that Data Download is selected. Click the Edit button and then for Include Writers in Download, select both TEXTLINE writers.

registerservices.jpg

 

6. Run the Workspace and View the Download

Log into your FME Server. Run the newly published workspace.

runworkspace.jpg

 

After it has finished running, click on the data download link to download the file.

downloadlink.jpg

 

Once downloaded, browse to the file and inspect the output to confirm the log file.

downloadedlog.jpg

 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.