One Star

[resolved] detailed Logging statistics

Hi,
I am using tFileList component to iterate and process few thousand files.
I have enabled tstatcatcher .But i need more information than that. (e.g i need file name also)
I made a generic context for it but I'm getting a popup "Can't not apply drag and drop operation on this components currently"

CAN ANYONE HELP ME WITH THIS.
Thanks,
Pankaj
1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: [resolved] detailed Logging statistics

You can access "pid" using tJava, tJavaRow, tJavaFlex, tMap.......any component where you can use Java.
To deal with a list of files you can use the tFileList component and get the filenames and paths using the related globalMap values. The screenshot below shows the globalMap variables that are available for tFileList.....


You can drag them from the Outline window to any area for a for putting Java code or most strings. They will actually appear something like this when you use them.....

((String)globalMap.get("tFileList_1_CURRENT_FILE"))
The variable above is for the filename for a tFileList component called tFileList_1
Rilhia Solutions
8 REPLIES
Fifteen Stars

Re: [resolved] detailed Logging statistics

You can't add data to the tStatcatcher schema as such, but you can keep your data elsewhere and link to that particular run using the "pid" Java variable that exists for all Talend Jobs. SO if you store your AMC stats in a database, you could create another table in that database which holds the extra info you want to report on and link the tables using the "pid" value. There are a whole load of variables that you can make use of in a Talend job. Go to your code tab and carry out a "find" for ....

public String pid = "0";

Where you find that you will find a load of public variables you can use to aid in your logging and stats.
Rilhia Solutions
One Star

Re: [resolved] detailed Logging statistics

Hi rhall,
Thank you for your response.
How can i access pid and i want make list files that are processed successfully and files which are not.
I want their file names and if possible reason why it failed.
Thanks,
Pankaj
Fifteen Stars

Re: [resolved] detailed Logging statistics

You can access "pid" using tJava, tJavaRow, tJavaFlex, tMap.......any component where you can use Java.
To deal with a list of files you can use the tFileList component and get the filenames and paths using the related globalMap values. The screenshot below shows the globalMap variables that are available for tFileList.....


You can drag them from the Outline window to any area for a for putting Java code or most strings. They will actually appear something like this when you use them.....

((String)globalMap.get("tFileList_1_CURRENT_FILE"))
The variable above is for the filename for a tFileList component called tFileList_1
Rilhia Solutions
One Star

Re: [resolved] detailed Logging statistics

Hi,
Thanks rhall,
Now i can get required details now i am trying to write these errors into a file.(as show in fig.)
i took tstatcatcher component and tried to write in txt file but its giveing me error after inserting 1 record.

Exception in component tFileOutputDelimited_1
java.io.FileNotFoundException: E:\temp.txt (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at demo.ffp_chg_load_dir_0_1.FFP_CHG_LOAD_DIR.tStatCatcher_1Process(FFP_CHG_LOAD_DIR.java:10368)
    at demo.ffp_chg_load_dir_0_1.FFP_CHG_LOAD_DIR$1tFileInputXML_7Thread.run(FFP_CHG_LOAD_DIR.java:3511)
    at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)
    at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)
    at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)
    at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)
    at java.lang.Thread.run(Unknown Source)
disconnected

I have give all the permissions to all users.
can u tell why its not working.
Fifteen Stars

Re: [resolved] detailed Logging statistics

It is claiming that access is denied to the file. Check the filesystem and the file to ensure that you have write access. A thing to try is to run Talend as an Administrator. This is sometimes an easy way to solve this issue.
Rilhia Solutions
One Star

Re: [resolved] detailed Logging statistics

Hi now m getting errors like
Exception in component tFileOutputExcel_1
java.lang.ArrayIndexOutOfBoundsException: 33522176
    at jxl.read.biff.CompoundFile.readSmallBlockDepot(CompoundFile.java:246)
    at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:187)
    at jxl.read.biff.File.<init>(File.java:127)
    at jxl.Workbook.getWorkbook(Workbook.java:221)
    at demo.test_0_1.test.tStatCatcher_2Process(test.java:1831)
    at demo.test_0_1.test.runJobInTOS(test.java:6903)
    at demo.test_0_1.test.main(test.java:6755)

and
illegal state exception


Smiley Sad
Thanks,
Pankaj
Fifteen Stars

Re: [resolved] detailed Logging statistics

Where are you using an Excel file? This error is to do with your tFileOutputExcel_1 component.
It is likely due to the fact that the Excel schema is not configured correctly, but I cannot tell from that message.
Rilhia Solutions
One Star

Re: [resolved] detailed Logging statistics

Hi ,
I used tLogRow component before writting in file and  that worked.
Thanks for your help.

Regards,
Pankaj