Skip to main content
We have a bunch of jobs running on FME Desktop, these jobs are run by windows scheduled tasks. However we are migrating to FMEServer and plan to schedule the jobs with the builtin scheduler. The problem is that in order for our outsourcing-partner to easily monitor these jobs it would be ideal if FME could write to the windows eventlog. Has anyone out there done this ?

 

In know of a few cmd-line programs that can write to the eventlog calling them from a workbench is one way to go or are there better options ?
You can use a python caller to execute the following script

import fme
import fmeobjects
import subprocess
# Template Function interface:
def WriteEvent(feature):
s = "eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO FMEJOBFAILURE /D \\"Job Failed\\""
subprocess.call(s, shell=True)
pass
You can use a python caller to execute the following script

import fme
import fmeobjects
import subprocess
# Template Function interface:
def WriteEvent(feature):
s = "eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO FMEJOBFAILURE /D \\"Job Failed\\""
subprocess.call(s, shell=True)
pass
Remember writing new event type needs Administrator privilege.

Sorry for the clumsy formatting, here is the script again:

import fme
import fmeobjects
import subprocess
# Template Function interface:

def WriteEvent(feature):
s = "eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO FMEJOBFAILURE /D \\"Job Failed\\""

subprocess.call(s, shell=True)

pass
You can use a python caller to execute the following script

import fme
import fmeobjects
import subprocess
# Template Function interface:
def WriteEvent(feature):
s = "eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO FMEJOBFAILURE /D \\"Job Failed\\""
subprocess.call(s, shell=True)
pass
hm... bad formatting stays. Anyway, doesn't seem to differ much from you Original suggestion.
You can use a python caller to execute the following script

import fme
import fmeobjects
import subprocess
# Template Function interface:
def WriteEvent(feature):
    s = "eventcreate /ID 1 /L APPLICATION /T INFORMATION  /SO FMEJOBFAILURE /D \"Job Failed\""
    subprocess.call(s, shell=True)
    pass

You can format it using the CODE tag, like this:

import fme
import fmeobjects
import subprocess
def WriteEvent(feature):
    s = 'eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO FMEJOBFAILURE /D "Job Failed"'
    subprocess.call(s, shell=True) 

Reply