Page 1 of 1
ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jun 29, 2016 8:37 am
by Ptec
Hey there!
I've (maybe) a simple question.
We have several TI Processes with "
;" 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 "
" 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
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jun 29, 2016 10:53 am
by Wim Gielis
Good old AsciiOutput function will do, with the function GetProcessErrorFileDirectory;
Then you can customize your own messages.
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jun 29, 2016 11:17 am
by Ptec
Ok, so you suggest to overwrite the log with ASCIIOutput?
Thanks
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jun 29, 2016 12:45 pm
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?
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jun 29, 2016 12:53 pm
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.
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Thu Jun 30, 2016 6:32 am
by sachin
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.
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Tue Jul 05, 2016 6:37 am
by Ptec
Thanks for your suggestions.
I think ASCII Output is the only way to do this at the moment.
Like
Wim Gielis suggested!
Re: ProcessError - How to output custom Error in the Logfile?
Posted: Wed Jul 06, 2016 11:41 am
by Wim Gielis
You're welcome !
Though I find LogOutput quite a good alternative to AsciiOutput, provided the software version allows it of course.