Write application log file

there are two ways
1, system("logger -t TAG MESSAGE")
2, write a self defined file

so i want to know which is better? it seems using logger will be simple

In general, this depends on your needs, but typically logger is preferable.
It helps to utilize build-in methods to filter, view, transfer and rotate logs.
So you can better integrate your app with OpenWrt and avoid extra work.