vani.sm@techmahindra.com
Page 1 / 1
Hi
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 = s]
def LogSkimmer(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
if not fme.status:
# Translation failed
global my_fme_messages
for msg in my_fme_messages:
# Do something with the error message(s)
print "Message was:", msg
David