Load of bollx.
GDPR does not restrict the type of data written into log files.
The question is around the type of information you are writing into a log file and whether that is considered to be personally identifiable information.
You might adopt a strategy of not storing any PII, and if you can achieve that, then you don't need to comply with GDPR.
Once you store a single item of PII then you have to comply.
A full IP address of a piece of equipment belonging to a natural living person, which enables that person to be identified is considered to be PII.
You should continue to store as much as you need in a log file to enable that log file to do its job of providing you with sufficient information for you to debug a problem.
The statement about not storing port numbers is utter nonsense: port numbers cannot be used to identify a living person.