Focal Point
Save webfocus messages to a log file

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4481058331

May 10, 2005, 04:14 PM
JimRice
Save webfocus messages to a log file
When running the following focexec in webfocus using devstudio(MR):
-------------------------------------
DEFINE FILE CAR
CNT/I5 WITH CAR = 1;
END
TABLE FILE CAR
SUM CNT
BY COUNTRY
ON TABLE HOLD AS HOLDCAR FORMAT ALPHA
END
? HOLD HOLDCAR
-------------------------------------
Results in the following messages:
--------------------------------------------------------------------------------

No HTML Output!

--------------------------------------------------------------------------------


0 NUMBER OF RECORDS IN TABLE= 10 LINES= 5
0DEFINITION OF HOLD FILE: HOLDCAR
0FIELDNAME ALIAS FORMAT
COUNTRY E01 A10
CNT E02 I5


I would like to be able to save these messages in a log file and copy this file to another directory. Can someone tell me how to write these messages to a file as well as being displayed as an html page?

Thanks
May 11, 2005, 06:40 AM
Cyril Joy
Hello Jim,

A simple method to save and display.

DEFINE FILE CAR
CNT/I5 WITH CAR = 1;
END

TABLE FILE CAR
SUM CNT
BY COUNTRY
ON TABLE SAVE AS HOLDCAR FORMAT ALPHA
END

TABLE FILE CAR
SUM CNT
BY COUNTRY
END
? HOLD HOLDCAR
-EXIT
May 11, 2005, 07:31 AM
<JG>
Unfortunately in WebFocus it's not possible to redirect the sysprint output.

The only option that is available is for you to use the browser file/save as option.
Make sure that you select text and it will drop the html tags.
May 11, 2005, 07:46 PM
JimRice
Hi JG,

Thanks for the response. I was afraid that might be the answer. If anyone else knows how to save the focus log messages, please let me know.

I will actually use reportcaster to schedule this process. Can the log messages be saved into a seperate file in this case?

Thanks
May 12, 2005, 12:39 AM
TexasStingray
Guys,

There is almost always a way to do anything in FOCUS/WebFOCUS. When You run a report and hold the output you can then use the CHECK FILE command and redirect the output to HOLD and then query HOLD. &LINES gives you the number of Records Held in the actual Reports.

TABLE FILE CAR
...

...

ON TABLE HOLD AS HOLDCAR
END

-RUN
-* Store TOTAL NUMBER LINES in var TOTALRECS
-SET &TOTALRECS = &LINES;
-RUN

CHECK FILE HOLDCAR HOLD

-* If you want to see what is in HOLD isses the following command

? HOLD

DEFINE FILE HOLD
TOTALRECS/I9 = &LINES;
END

FILEDEF SAVEME DISK ..........

TABLE FILE HOLD
PRINT
TOTALRECS
...
...
ON TABLE SAVE AS SAVEME FORMAT ALPHA
END


Hope this helps

This message has been edited. Last edited by: Kerry,
May 12, 2005, 02:43 PM
JimRice
Hi TexasStingray,

Thanks for the example. I would agree with you that there is usually a way to do about anything you want in Focus/Webfocus, but in this case, I'm looking for a way to redirect all messages to a file that could be saved for future reference or trouble shooting.

Thanks again for the post.

Jim
May 12, 2005, 09:31 PM
susannah
not in caster, but when you run a job Deferred, you can View the Echo file...and its saved ....
Old mainframe days we used to be able to save the sysout...
May 13, 2005, 02:08 PM
JimRice
Hi susannah,

Thanks for the input. I've picked up several tips from many of your other posts to this forum. It's always interesting to see how other people solve different problems. Thanks Again!

I'm a long time Focus user(mostly mainframe), but I'm new to webfocus and I'm still stumbling around trying to figure out this new environment.

I've got a couple of questions relating to this topic of saving the focus messages that are generated during the execution of a multi-step focexec:

1) You said when you run a job deferred, that you can view the echo file. Where is the echo file?

2) When I run a webfocus session, the following files(along with the .mas, .ftm, .foc etc files) are generated in the temp directory:
stderr.log and stdout.log
But unfortunately they are empty. Is there some way to activate these log files? Any help would be greatly appreciated.

Jim
May 17, 2005, 04:14 AM
Piipster
Try adding this to the beginning of your code....

FILEDEF EMGFILE DISK C:\IBI\EMGFILE.TXT
SET EMGSRV=FILE
-RUN
May 17, 2005, 04:50 PM
JimRice
Hi Piipster,

Thanks for the suggestion. I tried your filedef and set command but the file is always empty. Any thoughts?

Thanks
Jim
May 18, 2005, 12:21 AM
Piipster
You are running against Managed Reporting, right?

Where is your WebFOCUS Reporting server installed? This is where the file will get created. You need to be allocating a file on the server that you can create/write to.
May 20, 2005, 02:06 PM
JimRice
Hi Piipster,

The webfocus server is windows NT. I've tried running my test both in MR and outside of MR with the same results. The EMGFILE.TXT gets created on the server but is always empty. Any other ideas?

I would still like to know what these two files are used for during a febfocus session:

1) stderr.log
2) stdout.log

If I copy all files from the temp directory to a permanent directory, these two files are always there, but they are empty. Does anyone know about these files?

Jim
May 22, 2005, 11:47 PM
susannah
when you run a fex deferred (click right, pick Run Deferred from MRE Domain Builder..i never use devstu), then go look at it when its done (click on Deferred Status icon), one of the buttons you can select for that job when its done is VIEW...when you VIEW, you'll see the echo, provided of course you've set the echo on at the top of your fex.
Now, in the version i have (525), only the
-SET &ECHO = ON
part is viewable, not the complete
-SET &ECHO = ALL
Not good enuf but better than nothing.
We've all complained...they've listened...but i dont know where it stands. we want to be able to see the echo from a Caster job as well.
I'll upgrade and find out...

and... i have no idea what those log files are, either. someone wiser will come along and tell us. but here's something you can do, but its powerful so use carefully.
if you put this command at the top of your fex
SET TEMPERASE = OFF
you can then look inside that agent directory as your job is running and when its done..and all your interim hold files are still there. they won't be erased. you can examine them.
however...this setting is now in effect for your whole site...so its dangerous. if you've got a development box, you're fine. If not, SET TEMPERASE = ON (the default) as SOON as you can.
May 23, 2005, 07:37 PM
j.gross
quote:
however...this setting is now in effect for your whole site...so its dangerous
More precisely, the TEMPERASE setting remains as is, for that agent, and files remain in place in its temp directory -- which will affect whatever request next gets assigned to that particular agent.

Other agents go their merry may, quite unaffected.
May 23, 2005, 08:19 PM
susannah
Jack, i don't find that to be the case, actually.
May 24, 2005, 02:56 AM
j.gross
Depends.

If it's in edasprof.prf, the effect is global (since each agent executes that at start of any user's 'session').

But if it appears in an "application" fex, it will only have effect on a particular agent if and when the agent executes that fex.
August 05, 2005, 04:38 PM
vaayu
Jim,
Please let me know if you found the solution for saving the system log messages to a file. I need to do exactly the same thing here and I've been looking to find one all over.

Any help wud be greatly appreciated.

Thx
-P
August 08, 2005, 02:50 PM
JimRice
-P,

Sorry, no solution yet. I've got many jobs scheduled via reportcaster, but unfortunately don't have any log files to refer to in case I need to trouble shoot any problems. At the end of most of my focus procedures, I copy .ftm, .foc, .mas, .pdf files off to a permanent location, but I would sure like to be able to save a log file of the focus messages that are generated as well.

I'm glad you brought this up again. Maybe there is a solution out there, if so, please let us know.

Thanks
Jim
August 09, 2005, 08:20 PM
Boogarweed
This may be a stupid suggestion, but could you create log database entries using SQL passthru when certain conditions occur? You could log the values of global variables such as &FOCERRNUM &FOCFOCEXEC &DATE &TOD &IORETURN &RETCODE &LINES &READS &RECORDS... You get the idea. I don't know if this will do what you want or not. I hope so....

-IF &FOCERRNUM NE 0 THEN GOTO LOGERROR
-LOGERROR
SQL ORA
INSERT INTO LOG_TABLE(
LOG_DATE,
LOG_TIME,
LOG_ERROR)
VALUES (
'&DATE',
'&TOD',
'&FOCERRNUM');
COMMIT;
August 10, 2005, 03:31 PM
susannah
say Jim, what about your Caster log file? you say you don't have access to 'any log files'? Someone in your shop must have access to the Caster Console. In 52, the log has a nice small concise synopsis of every caster job, and highlights in RED if there's a messup; in 53 the log has the whole detailed log...and if you have &ECHO=ALL in your job you'll get more info that you can stand! well, more than i can stand anyway. Your log output for each caster job can actually look just like the Deferred Job output... Sounds like you need access to your Caster Console; Your admin should be monitoring that log anyway, and purging it from time to time.
August 10, 2005, 06:42 PM
dhagen
Jim, how good is your java? Your origional request can be done by writing a filter for the webfocus servlet. You can trap the servlet response, then selectively decide what to deliver and/or log.