wood burning stoves 2.0*
The moose likes Applets and the fly likes  java logging in JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark " java logging in JApplet" Watch " java logging in JApplet" New topic
Author

java logging in JApplet

ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi
I want to use java logging API in applet, i want to
use ConsoleHandler to get all the logs in my java
console, also i want to have a JDialog where i will
display various logging level options and then set the
log level from the selected option.
I dont want to use a properties file to set Log level,

how will i get it working if my package name is
"com.test.applet" and all the applet classes are
inside this package

Ashish


A$HI$H
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8900
    
    8

the Java Logging API supports both loading configuration from arbitrary sources (i.e. a class, a database) as well as dynamic configuration. Take a look at the Java Logging Overview for examples.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi
thanx, does any one have a working sample to set loglevel from a class and not from properties file, also security manager does not allow to set loglevel on ConsoleHandle in JApplet if it is not a secured applet

Ashish
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8900
    
    8

Did you happen to read the Java Logging Overview I pointed you to? Particularly the section marked "2.2 Changing the Configuration". That says "Here's a small program that dynamically adjusts the logging configuration. . ."
ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi
thanx for the direction, i did read the document and tried that code, it will not work in applet unless i make the applet trusted because of security reasons. I have to use getAnonymousLogger() in applet if it is not trusted, and dont know if i can setup log level for this logger in one class and can use the same log level in other class also,
for example
in my class A i define
Logger logger = Logger.getAnonymousLogger();
and set the logger leverl to ALL
then in class B if i again define
Logger log = Logger.getAnonymousLogger();
then what will be the log level, will it All or just info.
have to test this in program
Ashish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java logging in JApplet