• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to log in an applet

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a Java application you can log to a file (or the console) but how can you create logging information in an applet?
 
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angus Comber wrote:In a Java application you can log to a file (or the console) but how can you create logging information in an applet?



Applet has its own console window called Java Plugin Console.

Have a lookt at: Java Plug-in Console
 
Angus Comber
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah ok I have seen that. So System.out.println() goes there?
 
Nam Ha
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angus Comber wrote:Ah ok I have seen that. So System.out.println() goes there?


That's right.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use a logging library such as log4j from the apache software foundation.

If you decide to use this, a good idea is to get chainsaw also. The idea is to display the logging messages from log4j in a user-friendly interface as chainsaw.

More pointers :
- for each class use it's own logging object :
class MyClass {
static final private Logger logger = Logger.getInstance(MyClass.class);
[ ... code ... ]
}

- how to configure logger in the "log4j.properties" file for your project :

log4j.rootLogger=TRACE, Chainsaw

log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
log4j.appender.Chainsaw.layout=org.apache.log4j.PatternLayout
log4j.appender.Chainsaw.layout.ConversionPattern=%M - %L %n%m
#log4j.appender.Chainsaw.RemoteHost=localhost
log4j.appender.Chainsaw.RemoteHost=192.168.0.26
log4j.appender.Chainsaw.Port=4445
log4j.appender.Chainsaw.LocationInfo=true

Works like a charm
 
Saloon Keeper
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be very unusual to go to the trouble of setting up log4j in an applet; I wouldn't recommend it.
 
B Alin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
very unusual ?

funny thing, my co-workers agree it's unusual and at the same time expect me to trace bugs using messages to System.out and/or running the applet step-by-step in debug mode (NetBeans or your choice of an IDE).

unusual ? granted. useful ? very.
 
Nothing up my sleeve ... and ... presto! A tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic