Skip to main content
Solved

How to get log generated in custom transformer ?


I have a workbench which has a complex custom transformer added in which a python caller is present. I wanted to check what is happening in that python caller so I used some print statements. But I cannot find those print statements in logs that is being generated. How to get the log of a custom transformer in FME Desktop 2019.

Best answer by david_r

Print statements will appear in the on-screen log window, but will not necessarily be logged in the exact same order as the transformer messages, and may only appear on-screen and not in the log file. 

The best way to log messages is to use the FMELogFile object in the fmeobjects API. Example:

import fmeobjects
 
def my_function(feature):
    # Do something ...
    
    # Sends a message to the FME log file and console window.
    # Severity must be one of FME_INFORM, FME_WARN, FME_ERROR,
    # FME_FATAL, FME_STATISTIC, or FME_STATUSREPORT.
    message = 'This message will appear both on screen and in the log file'
    severity = fmeobjects.FME_INFORM
    fmeobjects.FMELogFile().logMessageString(message, severity)
 
    # Do something else here...

 

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

2 replies

david_r
Celebrity
  • Best Answer
  • August 11, 2021

Print statements will appear in the on-screen log window, but will not necessarily be logged in the exact same order as the transformer messages, and may only appear on-screen and not in the log file. 

The best way to log messages is to use the FMELogFile object in the fmeobjects API. Example:

import fmeobjects
 
def my_function(feature):
    # Do something ...
    
    # Sends a message to the FME log file and console window.
    # Severity must be one of FME_INFORM, FME_WARN, FME_ERROR,
    # FME_FATAL, FME_STATISTIC, or FME_STATUSREPORT.
    message = 'This message will appear both on screen and in the log file'
    severity = fmeobjects.FME_INFORM
    fmeobjects.FMELogFile().logMessageString(message, severity)
 
    # Do something else here...

 


  • Author
  • August 11, 2021
david_r wrote:

Print statements will appear in the on-screen log window, but will not necessarily be logged in the exact same order as the transformer messages, and may only appear on-screen and not in the log file. 

The best way to log messages is to use the FMELogFile object in the fmeobjects API. Example:

import fmeobjects
 
def my_function(feature):
    # Do something ...
    
    # Sends a message to the FME log file and console window.
    # Severity must be one of FME_INFORM, FME_WARN, FME_ERROR,
    # FME_FATAL, FME_STATISTIC, or FME_STATUSREPORT.
    message = 'This message will appear both on screen and in the log file'
    severity = fmeobjects.FME_INFORM
    fmeobjects.FMELogFile().logMessageString(message, severity)
 
    # Do something else here...

 

Got it.. Thanks 


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