Question
· Jul 28, 2020

Get Application Error Log by SQL

Does anyone know if there is a table or query to get the Application Error Log (^ERRORS) by SQL?

Discussion (7)2
Log in or sign up to continue

Did you take a look at the SYS.ApplicationError class? It has methods and class queries for reading the Application Error Log.

For example, to get the dates when errors were logged for a particular namespace TEST, you can use

do ##class(%ResultSet).RunQuery("SYS.ApplicationError", "DateList", "TEST")  

Or to manually parse the results, you can use

set $NAMESPACE = "%SYS"
set resultSet = ##class(%Library.ResultSet).%New("SYS.ApplicationError:DateList")
set status = resultSet.%Execute("TEST")

Thanks for the hint. 
I was pretty sure there should be something similar to serve SysMgmtPortal. I just didn't know.
Obviously the authors had the same problems as me with the old structure and applied a bunch of custom queries.
I don't think I missed something:
- the class is deployed so you have to accept what it does.
differently  %ERN.int doesn't hide anything and speaks full truth. 
- next to use it you require full access rights to %SYS and a namespace change %SYS to run it.
- and finally the topmost requirement: The queries are invisible to SQL! 
Just because not being exposed as SqlProcedure.

My solution runs in any namespace on Caché / Ensemble / iris .
Without any privileges and doesn't touch any ISC copyrights!