By default mongod will record queries slower than 100ms to the logs, which will be printed to stdout by default, or directed to a file using the --logpath option.
In later versions of MongoDB (6.0.4 in this example), it will look like this:
In 4.0 this may look a bit different, but since the 4.0 series was not supported anymore as per April 2022 I would encourage you to upgrade to a supported version.