I created a Batch that looks like this :

>     FOR %%D in ( Paris Pas-de-Calais Pyrenees-Atlantiques Pyrenees-Orientales) DO (
>     fme.exe jointure_cana_region_dep.fmw 
> V0_022013\INPUTS\cana_departements\%%D.shp" 
> V0_022013\OUTPUTS" 
>     --LOG_FILE %%D.log )
>     pause

My question is, Is there a Command Line that allows to create the LOGs in a specific file? because I know that they are created but I don't know where ? I tried this command :

> --LOG_FILE "W:\LAB\OAD\G@zmaps\DATA\Workspaces\STEP1_DECOUPAGE_CANA_DEP\Jointure_cana_dep_V0\LOG\%%D.log"

  • Do you set the log file in the FME Workbench? If it is not defined then by default it is written to the same directory as the .fmw file. Could you write the output of the batch file to a log file using ">> output.txt"? Commented Aug 22, 2013 at 9:35
  • T set it as a Published Parameter:
    – OAD FME FR
    Commented Aug 22, 2013 at 9:40
  • I set it as a Published Parameter: Type :Texte and I tried too Type : Directory (output) and I set my Default Value : >>W:\LAB\OAD\G@zmaps\DATA\Workspaces\STEP1_DECOUPAGE_CANA_DEP\Jointure_cana_dep_V0\LOG\%%D.log but I had no Log written. i tried too >>output.txt, and didn't work. I must have forgotten something..
    – OAD FME FR
    Commented Aug 22, 2013 at 10:00

1 Answer 1


This works: http://fmepedia.safe.com/articles/How_To/Batch-Processing-Method-1-Command-Line-or-Batch-File

In the workbench set the Log File under Workspace Parameters to a User Parameter which then appears as a Published Parameter.

Make sure you set the LOG_FILE parameter in the batch to look like this:

--LOG_FILE "c:\temp\logs\%%~nD.log"

Meant to say that you need to add the batch file modifier "~n" to your variable to expand it to include the file name of your variable. See here for more info http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

My simple batch file that I use is this:

REM call FME workbench and log output to report.txt
FOR %%F IN ("C:\temp\*.shp") DO (
    fme.exe grid_creator.fmw --SourceDataset_SHAPE "%%F" --LOG_FILE "c:\temp\logs\%%~nF.log"

    echo %%F >> c:\temp\logs\report.txt

    FIND "Translation was SUCCESSFUL" "c:\temp\logs\%%~nF.log" >> c:\temp\logs\report.txt

This reads the shapefiles in c:\temp into %%F and runs the workbench for each one. The log file has the same name as the input shapefile through the use of %%~nF. Maybe change your input list to read *.shp and change your SourceDataset_SHAPE to %%D and your DestDataset_SHAPE to have %%D.

This is the contents of my report.txt:


2013-08-22 15:24:33|   5.7|  0.0|INFORM|Translation was SUCCESSFUL with 2 warning(s) (0 feature(s) output)


2013-08-22 15:24:37|   2.9|  0.0|INFORM|Translation was SUCCESSFUL with 2 warning(s) (0 feature(s) output)

You could do a fanout in the workbench on fme_basename after setting the reader to read all shapefiles in the source directory but not sure how you would write out separate log files for each one.

  • Thank you so much for your answer, it helped me and it worked as I wished.
    – OAD FME FR
    Commented Aug 22, 2013 at 12:44
  • I have a last question. How can I have the same FILENAME for both my OUTPUT written SHAPES and my LOG FILES instead of the name of my variable?
    – OAD FME FR
    Commented Aug 22, 2013 at 13:59
  • Does your workbench change the name of the shapefile on output? My workbench read a shapefile, created a 1km buffer and wrote the output to the inspector but could equally have written to shapefile and kept the same name. Commented Aug 22, 2013 at 14:38
  • Yes, I used a "StringConcatenator" --> String Expression : @Value(CODE_DEPAR)_@Value(REGION) and then I checked Fanout by attribute to have the new Filename.
    – OAD FME FR
    Commented Aug 22, 2013 at 14:45
  • Hmm, having a think about it your second question should be a new question as it is not simple because the batch file does not know what FME will be writing out only what is going in. Commented Aug 22, 2013 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.