What's the best practice for log file locations in Java desktop applications?

ε祈祈猫儿з 提交于 2019-12-22 21:34:29

问题


I have a Java Webstart application and I want my log output to go to a file. The application must work on Mac OS X and Windows (and it'd be nice to work on Linux and generally any Unix).

I'm using Logback.

Where should I place my log files? Is there standard code to get a file location that is suitable for logs and will adjust the location appropriately for each platform?


回答1:


I would in most cases put it in the user's local Application Data directory. That might not be relevant depending on your application.

I found this earlier question relevant when I needed a place to put my logfiles on a Windows machine: Where to store an application log file on Windows

Unfortunately, I don't believe there's a function to get the best location for each platform.



来源:https://stackoverflow.com/questions/34073007/whats-the-best-practice-for-log-file-locations-in-java-desktop-applications

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!