evolution framework

Evolution Framework Blog

Web browser client logging

April 15, 2015 by Matija Tomašković in Engine

In web applications, typically logging is done on web server. However, if there are errors in JavaScript code in web browser such errors are only visible to end user using web browser. Depending on web browser and web browser settings end user might be alerted with confusing error message or such error will be "invisible" for user ending up in console log which is typically not visible to end user. 

 

Evolution web client logging is mechanism for handling JavaScript logging and catching JavaScript errors which sends client log to server for easier detection and analysis of such errors. It is using HTML5 Local storage feature to store small portions of log and is using regular user AJAX requests to send parts of client log without making additional AJAX requests to server just for sending log lines. 

 

Figure 1. Sample of JavaScript error – e.g. problem in code handling click on checkbox in grid

 

Figure 2. Web browser client logging configuration

 

 

How to analyse client errors

 

Suppose that there is JavaScript error which happens on GUI form ProjectIssues when user clicks checkbox (see Figure 1.) 

 

Such JavaScript errors are catched in window.onerror handler of Evolution client Log if web client logging is configured to be enabled. If sending to server is also enabled then Evolution JavaScript log will send client to to server where these lines will be copied to server log file and to "All messages" section visible also on Evolution daily report. 

 

Figure 3. Web client logging configuration

 

You can find web client warning/errors in menu option ADMINISTRATION > All messages.

Error subject contains text "(WEB CLIENT)".

 

Figure 4. Sample client errors 

 

For every web client warning/error you can see:

  • when it happened,
  • to which user it happened,
  • warning/error message, e.g. JavaScript error catched in window.onerror handler (in that case it should contain line number and JavaScript filename).

 

 

Warning/error message details - CREQ ID

 

When you open client warning/error message, you should see more details and check description:

 

Figure 5. Client error details

 

In error description you should see:

  • session ID, e.g. S00024696 - "S" stands for session while number is actual current session_id from database table c_web_sessions
  • client request ID, e.g. CREQ00032567 - "C" stands for "Client", "REQ" stands for "Request", 00032567 is same as first web request opening form – you should be able to find it in epis_main.log

 

In main server evolution log you should be able to find same ID:

 

Figure 6. Server log having request with same REQ ID

 

 

Client log analysis by CREQ ID

 

Having CREQ ID from warning/error message and exact time of client error, you should now open client log and search for more details.

Client log is placed in Evolution log folder on web server and has default name "epis_client.log". 

 

Figure 7. Evolution log folder having web client log

 

In this log you should now search for CREQ ID.

  

First line is most important, it is logged by server when rendering initial HTML of GUI form. This line has "(server)" marker and says for which user and which GUI form is this about:

 

Figure 8. Client log for CREQ ID – first line

 

E.g. it says that user #4 opened form ProjectIssues. 

 

Next lines are log lines from web browser i.e. logged in JavaScript:

  • Init JS executed ok
  • GForm.setState executed ok (from start to end)
  • after using f_filter field there was JavaScript error in cached JS line 10199 (see photo below)

 

Figure 9. Client log for CREQ ID

 

Here you can see that same error logged.

 

 

Analysing errors in GUI cached JavaScript

 

If there is problem in GUI cached JavaScript, you can analyse it like this:

  • open modules/cache/m_gui/20150413-20150413210131_cached.js
  • go to line on which error was reported

 

Figure 10. GUI engine JavaScript with line reporting error

 

  • scroll up to see which JavaScript file this is about – here it says that this is ggrid.js:

 

Figure 11. Name of actual JavaScript file

 

You should now have all information you need to resolve this JavaScript error.