Hi Community,
I have FeatureWriters creating log text files for me depending on various conditions.
If the conditions are not fulfilled the files are still generated but empty and emailer still sends those empty files as attachment.
How can i stop this from happening, so that only the log files with any values are sent as attachments with email.
Thank you
How I configured this:
- AttributeCreators creating log messages.
- Aggregator to concatenate these log messages into one text attribute.
- FeatureWriter to write temp logfile.
- AttributeRenamer to rename _dataset attribute to LogFilePath.
- Aggregator to merge logfile FeatureWriter with data FeatureWriter output.
- Tester to test if a logfile was written (LogFilePath has a value).
- 2 Emailer transformers, one with attachment, one without.
How I configured this:
- AttributeCreators creating log messages.
- Aggregator to concatenate these log messages into one text attribute.
- FeatureWriter to write temp logfile.
- AttributeRenamer to rename _dataset attribute to LogFilePath.
- Aggregator to merge logfile FeatureWriter with data FeatureWriter output.
- Tester to test if a logfile was written (LogFilePath has a value).
- 2 Emailer transformers, one with attachment, one without.
Hi Nielsgerrits,
Is it possible for you to share the setup screenshot?
What i am doing is entering data straight to the Featurewriter, which creates the file with filename+timestamp. (Timestamp uses a user parameter of python code).
A file name extractor extracts that name and the attachment filepath URL is updated accodingly.
We use different variants, but collect logmessages and write to logfile and the emailers is mostly the same in most workspaces.
We use different variants, but collect logmessages and write to logfile and the emailers is mostly the same in most workspaces.
Thank you so much Nielsgerrits, its clear now what you were explaining earlier. Hopefully I can adapt it to my usecase.
Thank you so much Nielsgerrits, its clear now what you were explaining earlier. Hopefully I can adapt it to my usecase.
Cheers :)
Another solution I found is to use the community made transformer caller filePropertyExtractor which gives various details about the file.
I check the file size and run through the tester, as I know that my empty files are less than 5 bytes(~1KB), anything bigger than that is sent to emailer and rest are not.
Just another way of doing the same thing , for anyone looking this up in future!
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.