ProcessError - How to output custom Error in the Logfile?

Post Reply
Ptec
Posts: 15
Joined: Mon Mar 14, 2016 9:14 am
OLAP Product: TM1
Version: 10.2.2.0
Excel Version: 2013

ProcessError - How to output custom Error in the Logfile?

Post by Ptec »

Hey there!

I've (maybe) a simple question.

We have several TI Processes with "

Code: Select all

Processerror
;" in IF Statements.

We now need , that if ProcessError is executed, a custom String Text will be written to the "TM1ProcessError_Timestamp_Processname.log" is written, which are automatically generated in the "Logfiles" folder.

I've read around the "

Code: Select all

LogOutput
" Command but cant get that working on our 10.2.2 Server...
https://everanalytics.wordpress.com/201 ... ognos-tm1/


Any hints would be very appreciated!

Thanks
Daniel
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: ProcessError - How to output custom Error in the Logfile?

Post by Wim Gielis »

Good old AsciiOutput function will do, with the function GetProcessErrorFileDirectory;

Then you can customize your own messages.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Ptec
Posts: 15
Joined: Mon Mar 14, 2016 9:14 am
OLAP Product: TM1
Version: 10.2.2.0
Excel Version: 2013

Re: ProcessError - How to output custom Error in the Logfile?

Post by Ptec »

Ok, so you suggest to overwrite the log with ASCIIOutput?

Thanks
BrianL
MVP
Posts: 264
Joined: Mon Nov 03, 2014 8:23 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2 PA2
Excel Version: 2016

Re: ProcessError - How to output custom Error in the Logfile?

Post by BrianL »

LogOutput was introduced in 10.2.2 FP1 which has been out since 2014, so if you have any fixpacks for 10.2.2 you should be able to use this function.

If you are running a version of TM1 that has this function, could you provide us with an example of how you're trying to call the function and what your tm1s-log.properties file contains?
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: ProcessError - How to output custom Error in the Logfile?

Post by qml »

Ptec wrote:We now need , that if ProcessError is executed, a custom String Text will be written to the "TM1ProcessError_Timestamp_Processname.log" is written, which are automatically generated in the "Logfiles" folder.
First of all it's worth remembering that once you execute ProcessError then no other code will run, so any custom log outputs need to happen before or instead of ProcessError. Also, LogOutput allows you to write to the server log, not to process error logs.

If errors are encountered during the execution of a process, a temporary 'log$' file is created. If you use ASCIIOUTPUT to write to a file with the same name with the 'log' extension then it's likely to be overwritten at the end when 'log$' is renamed to 'log'. If you try and write to the 'log$' file then that will fail too because the file is locked by the server.

One way to do what you want is to use ItemReject( YourCustomErrorString ) - this will add an entry to the error log that will contain the encountered record (on Metadata/Data) as well as your message. This is at the cost of stopping the execution of the rest of the code on the tab. On Metadata/Data it will just go straight to the next record, but when used in Prolog it will skip the rest of Prolog, so be careful with your code structure. What some people do is set a flag variable (e.g. nErrorFound=1) and raise a ProcessBreak when an issue is encountered (this causes a jump to Epilog) and then in Epilog you check if the flag variable is set and if yes, you do an ItemReject there.

But why not use ASCIIOutput to write to your own custom logs seperate to the ones TM1 generates automatically? You can use a naming convention that is similar. Just catch all the possible errors in the code and print them out to custom logs in any format you like.
Kamil Arendt
User avatar
sachin
Posts: 92
Joined: Fri Jan 15, 2010 9:54 pm
OLAP Product: Transformer,SSAS, EP, TM1
Version: 7.3 2005 10.1 10.1.1
Excel Version: 2013
Contact:

Re: ProcessError - How to output custom Error in the Logfile?

Post by sachin »

Ptec wrote:
I've read around the "

Code: Select all

LogOutput
" Command but cant get that working on our 10.2.2 Server...
https://everanalytics.wordpress.com/201 ... ognos-tm1/


Any hints would be very appreciated!

Thanks
Daniel
LogOutput function was mentioned in the Vision conference. I had written this out during that time frame. Subsequently an IBM KB article has come out explaining the use - http://www-01.ibm.com/support/docview.w ... wg27047744

You may be aware, but I wanted to point it out ... logouput writes to the tm1server.log; it does NOT write to the timestamped error log file of a TI process.
Check out my blog for some good information on TM1, SPSS
Ptec
Posts: 15
Joined: Mon Mar 14, 2016 9:14 am
OLAP Product: TM1
Version: 10.2.2.0
Excel Version: 2013

Re: ProcessError - How to output custom Error in the Logfile?

Post by Ptec »

Thanks for your suggestions.

I think ASCII Output is the only way to do this at the moment.

Like Wim Gielis suggested!
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: ProcessError - How to output custom Error in the Logfile?

Post by Wim Gielis »

You're welcome !
Though I find LogOutput quite a good alternative to AsciiOutput, provided the software version allows it of course.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply