Using this pattern you can catch any error messages sent to the log window and access them in your shutdown script, e.g. for writing them to a database or a separate log file:
In the startup script we define a global list "my_fme_messages" and we tell FME to add all log file messages with a severity of WARN, ERROR or FATAL to it:
from fmeobjects import *
global my_fme_messages
my_fme_messages = []
defLogSkimmer(severity, text):if severity in (FME_WARN, FME_ERROR, FME_FATAL):
my_fme_messages.append(text)
FMELogFile().setCallBack(LogSkimmer)
In the shutdown script, we can then analyse "my_fme_messages" and do whatever we want with it:
import fme
ifnot fme.status:
# Translation failedglobal my_fme_messages
for msg in my_fme_messages:
# Do something with the error message(s)print"Message was:", msg
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.