This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java logging in JApplet

 
ashish kulkarni
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ashish kulkarni
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic