Jason
Jason

Reputation: 12333

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

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?

Upvotes: 3

Views: 927

Answers (1)

Jonas Tonny
Jonas Tonny

Reputation: 172

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.

Upvotes: 2

Related Questions