TeamMentor / TM_4_0_Design

Repo Holds TM 4.x issues
4 stars 3 forks source link

nodeTM and TMGraphDB need detailed, verbose, logging to file. #86

Open romichg opened 9 years ago

romichg commented 9 years ago

Lets not make the same mistakes we have with TM 3.5. Can we please have detailed logging, to file, of everything that is happening in the code. The debug level should be set in a parameter. Logging should only happen if(debug<=2) or if(debug<=10) etc.

romichg commented 9 years ago

Related to: https://github.com/TeamMentor/Master/issues/904

DinisCruz commented 9 years ago

Add something like https://www.npmjs.com/package/debug (or maybe a tracing feature like we have on TM 3.5 UI)

romichg commented 9 years ago

Yep, the idea is to have a log file that can tell us what exactly is going on in the application.

DinisCruz commented 9 years ago

I was reading yesterday about DTrace and node support for it, and it could be an interesting option:

FlameGraphs is also really interesting:

Other:

romichg commented 9 years ago

These are all good, but they are not what the task is asking for. These are tracing and profiling tools, what we need are log statements, inside the application, that state what is going on a the moment. For example

12:00:00pm Found user test1 in graphDb 12:00:00pm user test1 has 5 articles saved 12:00:00pm Added 5 saved articles to the My Article list 12:02:00pm Unable to connect to TM3.5 backend for content refresh 12:02:01pm TM 3.5 backdend back online, fetching data 12:02:05pm This line of code should never be reached, something screwed up. 12:02:05pm Unable to obtain 3.5. data 12:02:05pm Sending alert email to tm_Admin@...

DinisCruz commented 9 years ago

yeah, the ones you have are higher level logs messages

romichg commented 9 years ago

Exactly, these are the messages that should be inside the code. :)

DinisCruz commented 9 years ago

Here are more node specific logging solution:

https://github.com/nomiddlename/log4js-node https://github.com/Monwara/node-logging https://github.com/bluejamesbond/Scribe.js

DinisCruz commented 9 years ago

https://github.com/louischatriot/nedb-logger also seems a good option (specially if we start to use nedb on TM)

DinisCruz commented 9 years ago

This is now done with NeDB (I used this case study as preparation to tackle https://github.com/TeamMentor/TM_4_0_Design/issues/175)

there is now a .logs folder with one file per day containing the logs (written in real time).

This is actually a serialised NeDB instance so it supports the logging of more complex objects and the creation of a better UI to see it

You can also see the logs in real time using tail

image

The logging level is not implemented and I think it is something that we can add later (maybe once we have more types of log info coming out from TM)

romichg commented 9 years ago

Log file needs to be a text file, human readable. nedb-logger may not be the best solution for this.

DinisCruz commented 9 years ago

Add option to config file to turn it on and off