Skip to main content
Solved

Custom Python logging

  • February 19, 2017
  • 1 reply
  • 9 views

sunsilk11
Contributor
Forum|alt.badge.img+6

Hi

I am in the process of creating a bunch of workbenches and would like to use Python scripts to create a custom log file for each workbench, each with specific name and in specified location.

I would like to log only specific outputs, e.g. count of features failing geometry validation, Total count written, Total count failed etc..

Any suggestion what's the best practice to achieve this. Should I be using startup/shutdown scripts or python caller? I would also like to create the log file with a datestamp.

Thanks

Best answer by takashi

Hi @sunsilk11, I think you can do that with shutdown Python script. See this document to learn about FME predefined global functions/variables which can be used in a shutdown script.

FME Workbench | FME Workbench | Working in the Navigator | Startup and Shutdown Python Scripts | FME_END_PYTHON

For example, you can know how many features were written through a global variable called "fme.featuresWritten".

Some other data occurring while the translation such as geometry validation result can be saved as Python global variables using a PythonCaller and then accessed in the shutdown script. The concrete way is different depending on where/how the information occurs.

Regarding datestamp, it would be easy to use the Python standard "datetime" module.

View original
Did this help you find an answer to your question?

1 reply

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • February 20, 2017

Hi @sunsilk11, I think you can do that with shutdown Python script. See this document to learn about FME predefined global functions/variables which can be used in a shutdown script.

FME Workbench | FME Workbench | Working in the Navigator | Startup and Shutdown Python Scripts | FME_END_PYTHON

For example, you can know how many features were written through a global variable called "fme.featuresWritten".

Some other data occurring while the translation such as geometry validation result can be saved as Python global variables using a PythonCaller and then accessed in the shutdown script. The concrete way is different depending on where/how the information occurs.

Regarding datestamp, it would be easy to use the Python standard "datetime" module.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings