The location of log files depends on the operating system and on which network you're using.
This provides a cross-platform way of finding the debug.log file.
Usage example:
tail -f `bitcoin-cli getrpcinfo | awk '/logpath/ {print $2}' | tr -d \"`
Backport of Core PR15483