BuildOp using "Build" - how does one write a log m

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

BuildOp using "Build" - how does one write a log m

Post by ArndW »

I've been trying, without success, to write a message (either informational or warning) to the log file of a job calling the buildop. I can't find an example of a c++ call, either.

Has anyone actually written a buildop and done this? Which call did you use? All I can find are deprecated definitions and I can't even get those to work.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could always use system() and UVwrite!

(This (writing to log from a Build stage) is not something I've done.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can use fprintf with stdout or stderr to achieve this.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Sainath - could you please explain how this will write the equivalent of DSLogInfo() and DSLogWarn()? I did get output using

Code: Select all

std::cout << "this is a message\n";
but haven't found a way to write a warning message to the log
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

ArndW,

Are you saying that the solution works or not ?

You can try

Code: Select all

std::cerr << "this is a warning message\n";
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It won't work, because the log is either a hashed file or a table within XMETA.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

That will and does work. It is a tried and tested method.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's the job log we're talking about here, not a log file. I can't envisage any way that std::cerr could map to a hashed file or to a table in XMETA.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Actually, it does work, just as using a PRINT in a before-job of a PX or in a job sequence will put the value in the log.

The standard out for informational messages will only issue one log entry per job run, though. I would like my routine to issue one or more distinct warning messages to the log and would need to use something else.

The apt_util\ErrorLog.h header file contains numerous definitions, but they all seem to be deprecated and I haven't been able to get any of the calls to work. This is most likely due to my lack of cpp skills and this is why I'm asking around for a working sample so that I can use that to expand on.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Sainath.Srinivasan wrote:ArndW,

Are you saying that the solution works or not ?

You can try

Code: Select all

std::cerr << "this is a warning message\n";
Yes, I have the std:cout working, but all of the messages I send there end up in a single log entry and I am looking for a method of writing discrete log entries.
Post Reply