Skip to main content
Question

Writing to the windows eventlog


Forum|alt.badge.img
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 ?

4 replies

helmoet
Forum|alt.badge.img+8
  • March 7, 2016
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

helmoet
Forum|alt.badge.img+8
  • March 7, 2016
helmoet wrote:
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

helmoet
Forum|alt.badge.img+8
  • March 7, 2016
helmoet wrote:
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.

david_r
Celebrity
  • March 7, 2016
helmoet wrote:
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


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