on 03-18-2016 3:06 AM
Dear All,
I have developed a graphical mapping and has one UDF.
The UDF is calling a java class saved as Imported Archive.
I would like to add trace to the java class which will display in the sxi_monitor but unable to do so as it does not extends AbstarctTransformation or does not have access to the container object.
Please suggest if there is any way out.
Thanks and Regards,
Rana Brata De
Hi Rana,
You can add instance variable in the class and create getMessage() method to get the log message which is stored in the instance variable. In the method of external class you can assign the instance variable with required message which you want to log. In the UDF you can call this getMessage() to receice this log message and pass it to trace.
public class Math {
private String message;
public String getMessage() {
return message;
}
public int add(int a, int b) {
int c = a + b;
message = "Add method successful";
return c;
}
}
public String sampleUDF(int a, int b, Container container) throws StreamTransformationException {
Math math = new Math();
String output = Integer.toString(math.add(a, b));
container.getTrace().addInfo(math.getMessage());
return output;
}
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.