Create a file and write to it - VisualCron - Forum

Community forum

hjohnson
2020-01-08T22:53:40Z
Hello,

I have a job that I am looking to create a log file with. I want to, create the file and then write to it. I have a task that the output will be coming from.

Here are my tasks:
tasks.PNG

I am looping through the contents of a file, that was read, and I want to verify that those were added to the web service via the powershell task. I need the powershell task to continue on, even after a failure, that is why I want to write out my results to a log file that is then emailed to me. How do I go about creating the file? I do not see "create file" task anywhere and I get an error just running the write file task. It has to have the "append to file" checked, as I will be sending multiple results in the loop. The log file name should have the date on it, also. Is there any way to create a file in a task ahead of the loop?
Support
2020-01-09T10:29:46Z
I am not seeing what problem you have with the File write Task? Do you mean that the problem is that Powershell Task fails and it does not continue? If yes, you can just go to On error tab of that Task and tell it to ignore Non zero exit code.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
hjohnson
2020-01-09T13:57:15Z
the File Write task fails because there is no file to write to. I want to know how I can create a file first, so that the write task has a file to write to. The write task, itself, is not creating a file when I run it.

The powershell task works fine. I just want to write the output of each loop segment, from the powershell task, to a file so I can verify that every thing gets loaded. Kind of like a double check.
Support
2020-01-09T15:26:59Z
Originally Posted by: hjohnson 

the File Write task fails because there is no file to write to. I want to know how I can create a file first, so that the write task has a file to write to. The write task, itself, is not creating a file when I run it.

The powershell task works fine. I just want to write the output of each loop segment, from the powershell task, to a file so I can verify that every thing gets loaded. Kind of like a double check.



The write file Task should create it if it does not exist. But the folder needs to be there.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
hjohnson
2020-01-09T15:30:33Z
the folder is there, and I have verified that VC has write access, but I still get this error:
Exception in Task: System.UnauthorizedAccessException: Access to the path '**' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
at VisualCronService.ProcessTaskFileWriteClass.WriteFile() in C:\git\code\VisualCronService\Jobs\TaskProcesses\File\clsProcessTaskFileWrite.vb:line 72


**I had to remove the actual file path from the error message as for security purposes.
hjohnson
2020-01-10T16:34:42Z
This has been fixed. Someone had gone in and changed some permissions without my knowledge and where I could not see them.
Scroll to Top