Search code examples
javaloggingglassfishsandbox

What domain files would an application running in Glassfish have access to?


I'm working on a beta release of an application. This is a Java app that runs on Glassfish. Obviously we are getting bug reports from time to time. I would like to provide my users with a simple one-click button to get the server log from /domains/domain1/logs . I am not sure if the application is sandboxed in such a way that it can get to this log file.

Does glassfish sandbox the application in such a way that I would be prevented from getting the file? Is there a standard method or library I can use to get the logs? If the file permissions on the server are correct, can I just have my application read the file using an absolute path?


Solution

  • You application can read the server.log file directly. Note that the logs are rotated, so your application would have to reload the log file and maybe even provide access to the rotated logs.

    If you are using a web server front end, such as Apache, you could just serve the log directory. I think you could just create a symbolic link to that directory in your webroot.

    Be careful you are not logging any sensitive information as exposing a log file could be a security risk.