You would be better using the built in logging functionality in Mendix.
I wrote a small tutorial on how to do this a few years ago that will help you set this up.
In addition to what Robert already mentioned, if you have CommunityCommons included in your project, you can look in to Logging.java. It has methods like:
Look in to Log.java from CommunityCommons on how to use it
Why do you want to control the location of the logging yourself?
Mendix logs can be found when running locally in your console, when running in the cloud, you can find the live logging, download of current log and downloading archived logs in the project > deploy > logs