How does mongodb output its log to the console, such as inserting content, etc

  mongodb, question

How does mongodb output its own log to the console, such as inserting content, etc.
Output in logback. I don’t know what that configuration is. Does a great god know?

Show_sql settings similar to hibernate.

I don’t know if I understand it, if I don’tforkNor does it specifylogpathThe log is output to the console.

Update

According to your comments, the following are the updated contents.
The function you want is to record CRUD statements. There are several implementations (choose one of them):

  1. Using Enterprise EditionAudit log(not detailed);
  2. Use Profiling

    • Usage reference:

    • This command is valid for a single database;
    • The command will establish a system.profile collection in the current database to record all CRUD operations;
  3. Record slow query log

    • By default, execution exceeds100msThe statement of will be recorded to themongod.log(that is, the kind of journal mentioned in your comment)
    • You can use the parameters in the configuration fileslowOpThresholdMsModify the threshold value of the record statement (all records can be recorded if it is modified to 0);
    • You can also execute it directly from the command line without modifying the configuration file (avoiding restart):db.setProfilingLevel(0, 0)Online modification of slow query threshold;

Either of the above methods can achieve the goal, but it needs to be understood that recording all statements will cause extra burden on the database.May have a very serious impact on database performanceTherefore, it is only recommended to open it temporarily when troubleshooting problems and close it as soon as possible after completion.