Progressive-Learning-Platform / PLPTool6

Prototype for PLPTool frontend interface overhaul
2 stars 4 forks source link

Logger implementation #125

Open mjadhav1 opened 6 years ago

mjadhav1 commented 6 years ago

This task involves various subtasks:

PFA

AppliedProject_logger.pptx

tobielf commented 6 years ago

Summary for February 1st.

Doing/Done: Read Log4j java documentation

  1. I do the research on how the Appender object from https://www.tutorialspoint.com/log4j/log4j_architecture.htm.
  2. Studied different Logger levels and their use.
  3. I have designed the table schema(fields) for Log table. Problem/Solution:
  4. I didn’t get enough information about the xAPI and how it is integrated in log4j.
  5. I am looking more into it and taking the help from Prashant as well. ToDo:
  6. I will do some POC on Appender object and Logger levels.
mjadhav1 commented 6 years ago

Summary for February 2nd.

Doing/Done: POC on Appender object

  1. I have created a test java class to test the Appender object.
  2. I have taken help from https://howtodoinjava.com/log4j/how-to-create-logs-in-database-using-jdbcappender-in-log4j/
  3. I have faced some problems related to setting log4j properties but I am not facing any problem right now.
  4. I have created a table named Log in my local database. ToDO:
  5. I will do the testing on the local file and next step is to learn more about Logger levels and I will implement them in my local.
mjadhav1 commented 6 years ago
  1. I am working on the integration of log4j in my current branch. There were issues in compilation but now got resolved. ToDo: I will continue working on the log4j integration for this week.
mjadhav1 commented 6 years ago

Until Feb 18th:

  1. I had difficulty mapping username with the user email as I have to insert user email into the Logs table.
  2. The spring MVC authentication returns the Principal object which has getUserName() method. The email ID I have taken from the User object and UserDetails object and maintained a HashMap so everytime I need email id, I get the value from the hashmap. ToDO:
  3. Check the logger works in the multi-threaded environment or not.
  4. Implement the logger in the entire application.
  5. Unit and integration testing.
tobielf commented 6 years ago

Any document about your table schema design? Is this table only use for logging purpose, or it will be retrieved by other modules? Do you think about the read/write contention in this case? Is the log store in a single table? How many logs do you think a user can generate per day? What happens if the records go above million? Think about all these cases and do a brainstorm by your own, you will discover a lot issues. Then these things become your design decision as well as your unit/integration test cases.

mjadhav1 commented 6 years ago

I have uploaded the table schema design document(AppliedProject_logger.pptx) at the time of creating an issue on GitHub. This table is only used for logging purpose. None of the modules fetches records from the Logs table. Logs are stored only in the single table. MySQL can easily handle millions of records. You can check the documentation here(https://dev.mysql.com/doc/mysql-reslimits-excerpt/5.7/en/column-count-limit.html)). We can achieve table data every day or a week and truncate the existing table. As I am using log4j 2 framework, it can handle async requests. Log4j 2 provides various features. See the documentation here(https://logging.apache.org/log4j/2.x/manual/index.html). The performance of the log4j 2 is described here(https://logging.apache.org/log4j/2.x/performance.html).

mjadhav1 commented 6 years ago

Logger Design Document.pdf

Please find the logger design document and review it. Please let me know if you guys have any questions.

I have one question for @tobielf, as we are logging with separate logger levels for assembling(Level-ASSEMBLE) and simulator part (Level-SIMULATOR). If there is an error while assembling, shall I log using level ERROR or you want ERROR1, ERROR2?