Skip to content

Logging feature

Marcus Oskarsson requested to merge gh-3d960304/81/mguijarr/logging into master

Created by: mguijarr

(sorry for PR #80, I made a mistake with git in my own repo and it was closed automatically)

I implemented a basic logging feature for MXCuBE 3 ; it should close #14 (closed) I guess.

What has been done:

  • a new custom log handler is set up when server starts, directly under 'root' logger to be able to aggregate all log messages
  • clients "register" by connecting the new Logging route
  • all records are JSON-encoded and emitted to clients via SSE
  • on the client side, there is a new Logging component
  • it is deliberate that the Logging component is not part of redux, because I don't see the point of centralizing and keeping state for this component, or defining actions
  • as soon as web page loads, a global SSE event listener is created ; if connection to server fails, it should try to reconnect every 5 seconds. If connection is lost afterwards, it tries to reconnect every 30 seconds this was rather cumbersome to do, hopefully it is done right ; any improvement idea is welcome would it make a difference to use the websocket ? I tried SSE because I am much more familiar with it
  • all log records are kept forever (well, until page reloads...) ; at the moment in our desktop version of MXCuBE it is like this it doesn't seem to be a problem but...
  • the Logging component tries to display messages in a fancy way, using pagination: log records are limited to 20 per page ; newest log records are at the end
  • when a log record contains stack trace information (like "Exception" log records), it is possible to click on the message to have it fully displayed

Any comments/feedback would be highly appreciated.

PS: I hate the fact that react-router unmounts / remount components when changing from one page to another but I could not find any workaround, except moving 'System log' out of react-router control. Well, it works so it's ok but in fact this is why I had to make the global event listener it's not very clean IMO

PPS: this PR also deletes a file we don't need anymore (test samples list)

Merge request reports