Message Log

Post Reply
User avatar
Eric
MVP
Posts: 373
Joined: Wed May 14, 2008 1:21 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Chicago, IL USA

Message Log

Post by Eric »

Maybe this question will be a little more difficult.

I have a process that is a condition is met I use "ProcessQuit;" in the log file it displays
"YYY/MM/DD HH:MM:SS: "Proces Name": Execution was aborted by ProcessQuit Function."

I was wondering if there was a way build a Error file with details of why the process was aborted.
Regards,
Eric
Blog: http://tm1-tipz.blogspot.com
Articles: http://www.google.com/reader/shared/use ... /label/TM1


Production: 32 bit 9.0 SP2, Windows 2000 Advanced Server. Web: 32 bit 9.0 SP2, Windows 2000 Server. Excel 2003
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Message Log

Post by Martin Ryan »

"An" error file is reasonably straight forward, "the" error file not so easy.

To create an error file you can use the "ASCIIoutput" function. ASCIIOutput('C:\folder\file.csv', argumen1, argument2, ..., argumentn);

Combined with some if statements you can create some quite good logging for yourself.

Of note though, if you use the same file location in the Prolog, Metadata, Data and Epilog tabs then only the last one will survive. I.e. each tab overwrites the file if it previously exists.

To get around this, if I want headers I put count=0; in the prolog then in the data tab
if(count=0);
count=1;
asciioutput(file, headers);
endif;

HTH,
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
User avatar
Eric
MVP
Posts: 373
Joined: Wed May 14, 2008 1:21 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Chicago, IL USA

Re: Message Log

Post by Eric »

I am aware of the ASCIIOutput(); however, I did not know if doing it how you are suggesting works with the TM1 message log. To clarify my goal

1) Execute Process
2) Process Aborts Prompt
3) Click OK
4) Message Log appears and stated process aborted
5) Double click line in message log with error (IMPORTANT PIECE)
6) Error Report (that I created) opens with details

Does that clarify my question?

Thanks
Eric
Regards,
Eric
Blog: http://tm1-tipz.blogspot.com
Articles: http://www.google.com/reader/shared/use ... /label/TM1


Production: 32 bit 9.0 SP2, Windows 2000 Advanced Server. Web: 32 bit 9.0 SP2, Windows 2000 Server. Excel 2003
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Message Log

Post by Martin Ryan »

It does. I haven't got TM1 in front of me, so I can't verify whether this will work or not, but try using asciioutput and make the file location the logging directory with the file name in the same format as the other error logs. I've no idea if that'll work or not, but it'll give you something to try until someone comes along with a better idea...

Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Message Log

Post by Alan Kirk »

Eric wrote:I am aware of the ASCIIOutput(); however, I did not know if doing it how you are suggesting works with the TM1 message log. To clarify my goal

1) Execute Process
2) Process Aborts Prompt
3) Click OK
4) Message Log appears and stated process aborted
5) Double click line in message log with error (IMPORTANT PIECE)
6) Error Report (that I created) opens with details

Does that clarify my question?

Thanks
Eric
Not possible (with one qualification), unfortunately.

You can write the log file to the error log directory as Martin suggests, but the problem isn't with the log file, it's with the message log.

The message log (in later versions) is designed so that if you have a row which contains a log name in the format TM1Process*.log, you can double click on that line to launch the log file. This is, I must admit, a nice piece of UI coding.

The problem is that no matter what you do, neither ProcessQuit nor ChoreQuit will write the name of an error log file into the message log. Therefore you can't double click on it. It's only when TI itself aborts a chore that the name of the log file will be written. I suppose that it would be theoretically possible to put some bad code into the TI (triggered by an If condition) to make it barf, but when it does so it won't be writing YOUR error message but rather TI's own one.

And you won't have been able to generate your own message using ASCIIOutput first, because the log files are time stamped (to the second) and you can't be certain that you'd get the same time stamp for the file name.

Now for the qualification.

The one way that you CAN create an openable error log is by using ItemReject, since this will cause TI to create the log itself AND it allows you to write a custom message into the log. However there are qualifications to the qualification:
(a) You can only do it if the process has a data source, well duh;
(b) You can only do it in the MetaData or Data tab, duh again;
(c) The first time you ItemReject, the metadata or data code (as the case may be) will stop running for that record. You'd therefore need to store a variable value to allow the process to remember that you're going to ProcessQuit or ChoreQuit at the start of the next record (or in the Epilog, as the case may be).

Put simply, I'm not sure whether it would be worth it.

The longer term fix is to raise an enhancement request asking Iboglix to add an optional argument to the ProcessQuit and ChoreQuit. If the argument is populated it gets written to an error log, and the name of the error log gets written into the message log.

As per recent discussions, my bet is that the request will be ignored because it won't make a compelling audio-video presentation for new customers.

But it can't hurt to ask.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
Eric
MVP
Posts: 373
Joined: Wed May 14, 2008 1:21 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Chicago, IL USA

Re: Message Log

Post by Eric »

I read you response and wanted to try anyways. IT WORKED but it proceeded to process the Epilog. Here is my Code

PROLOG
=====================================================================
#Checks if new element already exist
IF( DIMIX(Dimension_p, Element_p) = 0);

# Create new element from parameters
DimensionElementInsert(Dimension_p,'',Element_p,'N');

#Add new element to consolidation
DimensionElementComponentAdd(Dimension_p,Consolidation_p,Element_p,1);

ELSE;
ItemReject('Element '|Element_p|' aready exist in '|Dimension_p|' Dimension');
ProcessQuit;

ENDIF;



EPILOG
==============================================================================
#Update Attributes for new element

AttrPutS(ElementDesc_p, Dimension_p, Element_p, AttributeName_p);


IF( CubeExists('}ElementSecurity_'|Element_p)=1);

LoopControl_v=1;

#Apply Security for New Element

While (LoopControl_v <= DIMSIZ('}Groups'));

ElementSecurityPut(
ElementSecurityGet(Dimension_p
,ELPAR(Dimension_p,Element_p,1)
, DIMNM('}Groups', LoopControl_v))
, Dimension_p, Element_p, DIMNM('}Groups', LoopControl_v));

LoopControl_v = LoopControl_v +1;
END;

ELSE;
#NOTHING


ENDIF;
Regards,
Eric
Blog: http://tm1-tipz.blogspot.com
Articles: http://www.google.com/reader/shared/use ... /label/TM1


Production: 32 bit 9.0 SP2, Windows 2000 Advanced Server. Web: 32 bit 9.0 SP2, Windows 2000 Server. Excel 2003
User avatar
Eric
MVP
Posts: 373
Joined: Wed May 14, 2008 1:21 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Chicago, IL USA

Re: Message Log

Post by Eric »

Iam still having issues. I think becuase the system expects there to be data it ignores the ProcessQuit command and processes every tab. I was trying to check if GetProcessErrorFilename is null, but I am can't get the sytmtax and I cannot find it in the help. Anyone use the IsNull function in TI?

Let me know

TIA
Regards,
Eric
Blog: http://tm1-tipz.blogspot.com
Articles: http://www.google.com/reader/shared/use ... /label/TM1


Production: 32 bit 9.0 SP2, Windows 2000 Advanced Server. Web: 32 bit 9.0 SP2, Windows 2000 Server. Excel 2003
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Message Log

Post by Alan Kirk »

Eric wrote:Iam still having issues. I think becuase the system expects there to be data it ignores the ProcessQuit command and processes every tab. I was trying to check if GetProcessErrorFilename is null, but I am can't get the sytmtax and I cannot find it in the help. Anyone use the IsNull function in TI?

Let me know

TIA
It doesn't IGNORE the ProcessQuit command... it just never gets there. That's what I meant by:
The first time you ItemReject, the metadata or data code (as the case may be) will stop running for that record.
In short, as soon as the code hits an ItemSkip or an ItemReject, it proceeds to the next record without executing any of the subsequent code for the data or metadata tab, as the case may be.

The workaround is to do something like this:

In the Prolog:

Code: Select all

s_AbortProcess = 'N';
In Data or Metadata, modify your code as follows:
ELSE;
s_AbortProcess = 'Y';
ItemReject('Element '|Element_p|' aready exist in '|Dimension_p|' Dimension');
Then, as the VERY FIRST LINES of both the Data tab and the Epilog tab, have:

Code: Select all

If ( s_AbortProcess @= 'Y');
ProcessQuit;
EndIf;
You can't get it to quit on that very record, but you can on the very NEXT record. (Or Epilog, as the case may be).
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
Eric
MVP
Posts: 373
Joined: Wed May 14, 2008 1:21 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Chicago, IL USA

Re: Message Log

Post by Eric »

The first time you ItemReject, the metadata or data code (as the case may be) will stop running for that record.
ohhhhh! Got it. Sorry to make you repeat yourself.
PROLOG s_AbortProcess = 'N';
Duh! That is so much easier than messing around with IsNull


I think I might add the following to all of my TI process as a Tribute
Genius = 'Alan Kirk';
Regards,
Eric
Blog: http://tm1-tipz.blogspot.com
Articles: http://www.google.com/reader/shared/use ... /label/TM1


Production: 32 bit 9.0 SP2, Windows 2000 Advanced Server. Web: 32 bit 9.0 SP2, Windows 2000 Server. Excel 2003
Post Reply