How to debug or log some special variables in Craft CMS? (Especially in a controller) I am going to debug the variables in controller files.

But I couldn't figure out how I can debug it and show the values into front-end site or in log files.

Do you have any ideas about this?

What is your debug mode which you often use when you work in a controller?
You could use for example the dd() method with the craft3-dumper package.
You can also use the debug toolbar.
You could also use Sentry to get a nice overview about your errors with the craft sentry package.
Or you could use xdebug. Or or or ... :)

So there are severals ways to debug something.