webstart application logging permission denied

前端 未结 2 609
梦谈多话
梦谈多话 2021-01-13 18:54

is it possible to use java.util.Logging and log to a file in a java webstart application? I have the following logging code:


 Handler fh = new FileHandler(\"myap         


        
相关标签:
2条回答
  • 2021-01-13 19:32

    The access control exception says this:

    "access denied (java.util.logging.LoggingPermission control)"

    The javadoc for the permission class says this:

    "Currently there is only one named LoggingPermission. This is "control" and it grants the ability to control the logging configuration, for example by adding or removing Handlers, by adding or removing Filters, or by changing logging levels."

    What you are doing clearly falls under the "control" permission.

    You will need to sign your application if it is to create/add its own log handlers.


    Incidentally, if you did manage to work around the LoggingPermission("control"), you would then run into another access issue in opening the log file.

    Both problems are solved by signing the application. You've then got the problem that the user has to accept / trust your signing key. But that is fair enough! As far as the Java security sandbox can tell, what you are doing could potentially damage the user's machine.

    0 讨论(0)
  • 2021-01-13 19:36

    Have you tried specifying an absolute path? Perhaps the issue is that you don't have access to the current working directory of the application itself.

    0 讨论(0)
提交回复
热议问题