span8
span4
span8
span4
The FMEObjects Python API is available for use in the Startup and Shutdown Python (Workspace Parameters - Advanced in Workbench), as well as in the PythonCaller and PythonCreator transformers. One of the objects available is the FMELogFile, which provides access to the Workbench log. Most of the FMELogFile methods are for adding messages to the log, but the setCallBack method allows you to send a copy of all log messages to your own function. This lets you parse the log messages as they are created and pass information from those messages to features in the workspace while it is running.
The three examples below illustrate some of the possible uses of log information during the workspace run.
A customer found that some of his Microstation DGN files had been truncated. Normally, FME just posts a warning in the log file if it encounters a truncated file, but doesn't fail the translation. The customer wanted failures in order to separate the truncated files from the correct ones.
The Workbench readers often report file or table metadata to the log, but do not add this information to the features read from the file. The DGNMetadata example extracts the Global Origin, Master and Sub unit names and ratios from all the Microstation DGN files in a folder and outputs this information to an Excel file.
Output:
The AffineWarper transformer calculates a best fit Affine transformation from input control vectors, then uses it to transform the observed features for output. The calculated parameters are logged, but not stored on the transformed features. The GetAffineParameters example extracts those parameters into a CSV file for alternative uses.
Hi @bo,
We seem to have changed the multi_reader_id numbering scheme, which messed up the indexing of the attributes. I have updated the workspace to deal with the new numbering.
As a bonus, I am including a workspace that does the same thing without Python, using the LogMessageStreamer transformer.
Hello @daveatsafe, thank You for perfect article. Anyway, I have feeling that DGNMETADATA.fmwt doesnt work correctly. I have tried to run it in FME 2018.1, FME 2019.1 and FME beta 2020 - everytime I ran WS, result was that all 3 DGN files have the same Sub Units, Master Units, etc. (not as on Your attached screenshot from Excel). It looks like FME reads only first found lines related to first loaded DGN file, not other.
Please, can You check this issue?
Thank You so much!
Lubo
Translation pauses and no more logging output is seen
Startup and Shutdown Python and Tcl Scripts
How to log out after running a translation (Windows OS)
Troubleshooting an fme.exe crash
Error: A Python installation could not be detected
Pyfme cannot be called from the command line with Data Interoperability
© 2019 Safe Software Inc | Legal