Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a problem with the tfile delete component. I build a job to upload a logfile to salesforce. To do this i have a Prejob which redirects the console output to a file with these lines:
context.WorkingDir = System.getProperty("user.dir"); context.Pid = this.pid; System.out.println(context.Pid); System.out.println(context.WorkingDir); context.LogFile = (context.WorkingDir + "\\" + context.Pid + "_log"); java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(context.LogFile)); System.setOut(ps);
Later i use tLogCatcher to collect the Logs and read the file as shown here:
The Logfile is uploaded successfully - after that i want to delete the Logfile within a Postjob:
But i get an exception that the file could not be deleted:
I thought that the file is maybe not properly closed, but i don't know how to do this i tried:
new java.io.FileOutputStream(context.LogFile).close();
But that didn't work either.
It would be great if someone could help/explain me what i'm doing wrong here.
Regards,
Olli
to do
in Prejob , add ps as globalMap variable at the end of code
globalMap.put("ps",ps);
then before deleting file in tPostJob, close the stream using tJava
((java.io.PrintStream)globalMap.get("ps")).close();
.. i also want to have a summary of what ID's are successfully uploaded. But LogCatcher only logs errors from java exception or tdie/twarn.
That is the reason i store everything in a file before i upload it.
The result looks like this:
### Starting Accounts SF2ERP_SQL ... SalesforceURL: https://login.salesforce.com/services/Soap/u/44.0 ERP : 192.168.0.65/Kunden Lastrun : Wed May 22 09:19:54 CEST 2019 LastrunSQL : 2019-05-20T05:00:51.000Z
knr 214578 220256 220039 215620 208529
...
...
It all works fine except the removing of the logfile.. 😞
Olli
to do
in Prejob , add ps as globalMap variable at the end of code
globalMap.put("ps",ps);
then before deleting file in tPostJob, close the stream using tJava
((java.io.PrintStream)globalMap.get("ps")).close();
Hi Akumar,
thanks again for your help, this works perfectly.
Oliver