Skip to main content
Question

How to write stuff to the Log?


nicholas
Contributor
Forum|alt.badge.img+12

I would like to write some messages to the Log, at the end of a successful Translation.

For example, the source schema & table name and the destination schema & table name

Is there a FME Transformer that can write a user parameter to the Log? With some surrounding text?

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+49

Easiest way is to use the Logger transformer, that allows you to log a custom message. Do keep in mind that that message is logged once per feature passing through.

 

Alternatively, a Python shutdown script, which will be executed after the processing.


nicholas
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • July 26, 2023

I do not want to write a message for every single feature.

I just want to write a message to the log when the Translation is successfully finished.

By Python shutdown script, do you mean the PythonCaller?

And that I should use a Print statement here?

  def close(self):

    pass


redgeographics
Celebrity
Forum|alt.badge.img+49

No, it's in the Navigator:

Workspace Parameters -> Scripting -> Shutdown Python Script

 

There's a good knowledge base article that should help you on your way: https://community.safe.com/s/article/shutdown-python-scripts-in-fme


nicholas
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • July 28, 2023

I can now successfully use the Shutdown Python Script to print a message to the Translation Log window

Now I need to figure out how to convert a Published Parameter into a string so that it can be printed.

User Parameters are;

sourceSchema

TableName

destSchema

But Print (sourceSchema) fails


nicholas
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • July 28, 2023

I think I got it

import fme

sourceSchemaVal = "Source Schema : " + fme.macroValues['sourceSchema']

print (souceSchemaVal)


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