Log Message with Stack Trace using Data Transform

How to log message with GenerateStackTrace enabled using a data transform ?

Using @pxLogMessage() we can only supply the message & Log Level. However there is no option to chose whether to generate StackTrace or not. Can someone help if this is feasible ?

Appreciate if any one suggest on this. :slight_smile:

@Dillu

Hi,

So that specific function is not going to output a Stacktrace. To output a Stacktrace using Log4j , oLog object usually, it’s pretty simple:

oLog.(, new Throwable());

You will get the message plus a stack trace.

Since you want to call this from a data transform you would have to create your own Rule-Utility-Function to handle this as there is no OTB function to that will output the message with a stack trace.

This is something I think we should have in the OTB as a new function like pxLogMessageWithStack().

Hi @ChrisKoyl Thank you for your response.

So meaning, currently we don’t have any OOTB function and we need to create if required.

Thanks again!

@Dillu

Correct, at this time you will need to create you’re own Rule-Utility-Function and use the code above to handle outputting the a log message with a stack trace.