Java 7u13 registration applet

I just installed a new JDK7u13 but the registration applet is not working. I don't see any log messages in the console. The applet worked fine in 7u11. I tried a simple program (not an applet) and it works. Of course I recompiled the applet, reworked the logging.properties. Is there a new setting that I have to tweak in the new JRE update?

Example:

Hello.class:

import java.applet.Applet;
import java.util.logging.*;

public class Hello extends Applet {

      private static final Logger log = Logger.getLogger("Hello");

   @Override
   public void init() {
      log.info("Hello!!");
      System.out.println("mmmhhhh....");
   }
   // TODO overwrite start(), stop() and destroy() methods
}

      

Console:

Java Plugin 10.13.2.20
Usando versión de JRE 1.7.0_13-b20 Java HotSpot(TM) Client VM
Directorio raíz del usuario = C:\Documents and Settings\commander
----------------------------------------------------
c:   borrar ventana de consola
f:   finalizar objetos en la cola de finalización
g:   recopilación de basura
h:   mostrar este mensaje de ayuda
l:   volcar lista de classloader
m:   imprimir uso de memoria
o:   disparar registro
q:   ocultar consola
r:   recargar configuración de política
s:   volcar propiedades del sistema y de despliegue
t:   volcar lista de threads
v:   volcar pila de threads
x:   borrar caché de classloader
0-5: definir nivel de rastreo en <n>
----------------------------------------------------
mmmhhhh....

      

Where is the "Hello !!" informational message?

In JRE1.6 (for example) the same applet produces:

Java Plug-in 1.6.0_07
Usar versión JRE 1.6.0_07 Java HotSpot(TM) Client VM
Directorio local del usuario = C:\Documents and Settings\commander
----------------------------------------------------
c:   borrar ventana de consola
f:   finalizar objetos en la cola de finalización
g:   liberación de recursos
h:   presentar este mensaje de ayuda
l:   volcar lista del cargador de clases
m:   imprimir sintaxis de memoria
o:   activar registro
p:   recargar configuración de proxy
q:   ocultar consola
r:   recargar configuración de norma
s:   volcar propiedades del sistema y de despliegue
t:   volcar lista de subprocesos
v:   volcar pila de subprocesos
x:   borrar antememoria del cargador de clases
0-5: establecer nivel de rastreo en <n>
----------------------------------------------------
05-feb-2013 11:18:50 Hello init
INFO: Hello!!
mmmhhhh....

      

Thank.

+3


source to share


2 answers


import java.applet.Applet;
import java.util.logging.*;

public class Hello extends Applet {

      private static final Logger log = Logger.getLogger("Hello");

   @Override
   public void init() {
      log.addHandler(new ConsoleHandler()); // ADD THIS LINE TO YOUR CODE
      log.info("Hello!!");
      System.out.println("mmmhhhh....");
   }
   // TODO overwrite start(), stop() and destroy() methods
}

      



For some reason, the LogManager does not read the property file handler value, so to solve your problem, you only need to add a programmatic handler as I show in the code above. I'll try to debug a little more.

+2


source


I used your applet code using jdk1.7.0_09 with this logging.properties:

handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

      



and I got this output in the console:

Feb 05, 2013 12:08:35 PM Hello init INFO: Hello! mmmhhhh ....

0


source







All Articles