[GIS] FME BATCH: How to create a “LOG” in a specific file output

batchfme

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 
>     --SourceDataset_SHAPE "W:\LAB\OAD\G@zmaps\DATA\SHAPES\CANALISATIONS_SIG\SIG
> V0_022013\INPUTS\cana_departements\%%D.shp" 
>     --DestDataset_SHAPE "W:\LAB\OAD\G@zmaps\DATA\SHAPES\CANALISATIONS_SIG\SIG
> 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"

Best Answer

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
    )
pause

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:

C:\temp\angus_council_bnd.shp 

---------- C:\TEMP\LOGS\ANGUS_COUNCIL_BND.LOG
2013-08-22 15:24:33|   5.7|  0.0|INFORM|Translation was SUCCESSFUL with 2 warning(s) (0 feature(s) output)

C:\temp\tayside.shp 

---------- C:\TEMP\LOGS\TAYSIDE.LOG
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.

Related Question