We currently have a single workbench stored in a central location being accessed and ran by various users, at various times. I would like to be able to incorporate the individuals system username into the log file name, as well as the date/time when they ran it. Is this possible?
Hi @cartoscro,
This should be possible using Python scripted parameters. The location of the logfile is a workspace parameter that is normally left blank. However, if populated, it will override the default logfile location.
You can right-click on the Log File setting and create a non-Published User Parameter. This makes it settable by a Python scripted Parameter. We have a tutorial on using Scripted parameters available here.
The timestamp is simple, but getting the username in Python may be more complex. There is a good conversation on how to do it in Stack Overflow.
For future reference, I ended up using this along with @DaveAtSafe suggestion to get the username, workbench name, and date/time appended to the logfile name.
import getpass, time, os
n = getpass.getuser()
w = FME_MacroValuese'FME_MF_NAME']
t = time.strftime('%Y_%m_%d_%H_%M_%S')
if w.endswith('.fmw'):
w = wf:-4]
path = n + '_' + w + '_' + t
return path
Easier than I thought it would be.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.