What is the best way to delete log files?

As per my knowledge we need to take back up of a log file before clearing the log file then needs to perform this like this: ">logfile".

Please correct me if I am wrong. And add your comments if any.

Also I want to understand how will ">" this help in clearing the log file. Whats wrong if we delete log file after taking backup, assuming that log file will create again automatically.

They probably meant something like "echo > logfile". This will redirect the output of 'echo' into the logfile, thus overwriting it with a single newline. Just deleting the logfile with rm doesn't work as expected since, if the file is still open, it will continue to exist on disk until closed.

Corona688 is correct.
Copy then null is the only safe way with a log file which is open for write.
In practice every log can be closed and opened in a controlled manner once you understand the process.

They probably don't. Actually echo is both unnecessary and might even annoy some log processing applications.

>logfile

is just telling the shell to redirect the "null command" to that file, which has the wanted side effect of clearing its content.
If one is uncomfortable with this terse syntax which might look like a syntax error to someone familiar with it, any command with no output can be used instead like:

true > logfile
:> logfile
sleep 0 > logfile

or even the famous

cat /dev/null > logfile

that many people think have some black magic power which it certainly has not.

Absolutely, a common mistake leading to "why is my disk still full while I've removed the big files from it" so frequent question.

Do not make this assumption. In many cases logging will stop completely if the log file is deleted.

I do not think there is an a better and simple way other that this

$ > logfiile 

Thanks to every body for your clear description.