15

In the Java Control Panel, I have enabled tracing and logging. I am troubleshooting a Java Applet.

The Java logs appear in the Java Console but aren't written to disk.

I checked in %APPDATA%\sun\java\deployment - but that directory is empty.

As per Java 8 documentation, that's where the logs are supposed to get written to. I am running JRE 8. How can this be fixed?

StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25
user93353
  • 13,733
  • 8
  • 60
  • 122
  • what are you using? Log4j? Post log4j.xml ;) – Bilbo Baggins Jan 11 '16 at 13:21
  • 1
    An applet typically can't write to disk. The Java sandboxing prevents it. – Stephen C Jan 11 '16 at 13:40
  • @Bilbo Baggins - I am using System.out.println to console. However, the java docs say that it can be redirected to disk. – user93353 Jan 11 '16 at 14:11
  • Anything written in applet code would be running at client side and not on server side. Check for the difference of applet and servlet, Applet gets downloaded in the client browser and then executed by browser. – Bilbo Baggins Jan 12 '16 at 05:06
  • @BilboBaggins - yeah, I know it will be running on client. I am looking to get it printed to disk on client. – user93353 Jan 12 '16 at 07:30
  • read this, something similar to what you are looking for. http://arstechnica.com/civis/viewtopic.php?t=905078 – Bilbo Baggins Jan 12 '16 at 08:13
  • @BilboBaggins - I am looking to redirect the whole of the console to a disk file. I am not looking to write anything from the applet to disk. A lot of the trace messages are written to the console by the JVM/Browser rather than the applet itself - that's why I want redirected to disk. – user93353 Jan 12 '16 at 17:30
  • What happens if you enter 'o' on the console? – Michal Jan 19 '16 at 21:48

5 Answers5

2

Another possibility of the tracing log file location is found from jre8 documentation:

If the environment variable USER_JPI_PROFILE is set to <user plugin home> 
then the trace and log files will be written to:
<user plugin home>\Sun\Java\Deployment\log on Windows

Source:

https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/console_trace_log.html

mico
  • 12,730
  • 12
  • 59
  • 99
1

From the Documentation, Java Console, Tracing, and Logging,

You need to set "Java Run Time Parameters" @22.2.1 Tracing as,

-Ddeployment.trace=true
-Ddeployment.trace.level=all

Also note that, @22.2.4 File Locations,

If the environment variable USER_JPI_PROFILE is set to <user plugin home> then the trace and log files will be written to:

  • <user plugin home>/.java/deployment/log on Solaris and Linux

  • <user plugin home>/Library/Application Support/Oracle/Java/Deployment/log on OS X

  • <user plugin home>\Sun\Java\Deployment\log on Windows

Confirm your Ddeployment.trace.level as well as USER_JPI_PROFILE

Hope it helps :)

Community
  • 1
  • 1
Let'sRefactor
  • 3,303
  • 4
  • 27
  • 43
0

As per java documentation, that's where the logs are supposed to get written to. I am running JRE 8. How can this be fixed?

Have you tried installing the JDK instead? The JRE is targeted at end users while the JDK is targeted at developers and/or sys admins. JDK 8 comes with JRE 8.

Saïd
  • 8,780
  • 1
  • 28
  • 28
0

What you have to do is to redirect the standard output to a file. Without that, whatever you run, it always be in the Java Console

I think you can take a look to this post System.out to a file in java

You may have to change standard applet security policy to allow your applet to write on the disk

Community
  • 1
  • 1
SebVb
  • 187
  • 1
  • 3
  • 14
0

Try the other "AppData" subfolders

Try these paths:

  • %userprofile%\AppData\Local\Sun\Java\Deployment\log
  • %userprofile%\AppData\LocalLow\Sun\Java\Deployment\log <= that's where it wound up for me.
  • %userprofile%\AppData\Roaming\Sun\Java\Deployment\log

Further reading

For background info see here:

StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25