One Star

How to add logs for each events in my job?

Hello,
I have seen the objects in "Log and error" in the palette but I don't manage to add logs for every events in my job. I want to log:
- every line added to my datawarehouse
- every error
- every warning
Do you have an exemple which this type of need ?

I also need to log a warning if in my tmap a join is not possible. I explain:
I have two input table (table1 and table2) in my tmap and one output table.
For each line in table1 I have to find some informations in the table 2. To do that, I do a join.
I want to log a warning if a line from table1 don't have a matched line in table 2.

any idea?
Thank you in advance,
Chris
6 REPLIES
Community Manager

Re: How to add logs for each events in my job?

Hi
If you want to get the lines which from table1 don't hava a matched line in table2, you can use tMap component to get the unmatched lines.
Please see the screenshot.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to add logs for each events in my job?

Hello,
Thank you for your help but I have still the problem. I have seen in the documentation the explanation of the use of Inner join with a reject table but I don't undertsand how to use it.
I think the best way will be to have an example. Do you know where I can find one?
Thank you,
Chris
Employee

Re: How to add logs for each events in my job?

Hi,
You can import the DEMO projects into your Talend Open Studio.
When you start the Studio, choose Import DEMO, select Java or Perl, you will have many JOBs in which you have documentations and using of many components and functionnalities.
Regards.
One Star

Re: How to add logs for each events in my job?

Hello,
Thanks a lot to help me and the demo project is very helpfull. I have found the example tMap_4 with a reject table but my situation is a little differente because I use two joins.
When I run the process, I have a NullPointerException when row6.pro_id is null.
This is my tMap

or here: http://chris38.wikispaces.com/space/showimage/tMapPb.gif
The most strange is that the job work well when I delete the table "row2" of the tMap, ie I can see the logs of reject_table (ie lines with row6.pro_id == null) and the logs of selling_table.
Do you have an idea,
Thanks,
Chris
One Star

Re: How to add logs for each events in my job?

Sorry about the image. You can see it better with the link http://chris38.wikispaces.com/space/sho ? tMapPb.gif.
I have not any answer. Maybe my question is not clear enough.
The table row5 is the main table. I need to access to the information pro_code_type in the row2 table.
To do that, I have to do a join between row5 and row6 with the field dep_id and a join between row6 and row2 with pro_id.
The problem is it is possible that row5.dep_id is null.
Actually, when row5.dep_id is null is null I have a nullPointerException just here in the code: row7HashKey.pro_id = row6.pro_id (because row6 is null).
I don't find a solution.
Any idea?
Thanks,
Chris
One Star

Re: How to add logs for each events in my job?

Hi chris23
I think the problem is "row6.pro_id" has null value. Because when you delete row2, it works well. The point of problem is between row2 and row6, I think.
You write "row6.pro_id != null". It means "If row6.pro_id is not null, Output values." not "If row6.pro_id is not null, Join with row2.pro_id".
I think so.
Forgive me if I'm wrong.