cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting errors from server messages

justin_willey
Participant
2,469

I want to be able to give admin users a warning when errors that might not otherwise be see (eg errors generated by events) are logged. I thought about filtering the server messages for errors.

When server messages are written to a log file, they are nicely categorised with a message type indicator at the beginning of the line:

E. 01/25 05:00:49. Handler for event 'iqx_updateLapsed' caused SQLSTATE '23W01'

E. 01/25 05:00:49. Primary key for table 'contactevent' is not unique : Primary key value (''MG49000525012014004A'')

E. 01/26 05:00:46. Handler for event 'iqx_updateLapsed' caused SQLSTATE '23W01'

E. 01/26 05:00:46. Primary key for table 'contactevent' is not unique : Primary key value (''MG460005260120140068'')

I. 01/26 05:56:37. Starting checkpoint of "IQX" (pears.db) at Sun Jan 26 2014 05:56

I. 01/26 05:56:46. Finished checkpoint of "IQX" (pears.db) at Sun Jan 26 2014 05:56

However that indicator isn't present when server messages are retrieved using the property('Message',n) or property('MessageText',n) functions. The exact text used to indicate the error is hard to predict and it is particularly difficult to get the additional information (eg the second line in the messages above). Is there, or could there be, a way of retrieving the indicator as well?

I could grep the output file - but that does seem a bit of a round about way of doing it!

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

Take a look at the sa_server_messages system procedure - it contains all of the information that you need including message severity (INFO, WARN, ERR)

justin_willey
Participant
0 Kudos

perfect - thank you! (I was used to the old get_server_messages function)

select msg_time, msg_text from sa_server_messages(0,1000000) where msg_severity = 'ERR' order by msg_id desc

VolkerBarth
Contributor
0 Kudos

FWIW: Here's another link on that topic:

How to replace the server property "Message" and the like?

Answers (0)