LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2009, 06:52 AM   #1
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Log4j anyone???


Hi,

I need some logging mechanism in my Java development. The dev setup is as follows (just to give you an idea) server CentOS 5.2 with java 1.6, PHP and mySQL on the one end, and Fedora 10, (openJDK?) on the dev side. Ok, so I have a website on the server that I "surf" to (entering the IP address - life CAN be simple) and call up an info page that is on the server...not. I get a blank page - applet (possibly) crashed on me...

Result: I need to log what the applet screams before it dies on me, enter log4j.

Just to test, this is what I "fumbled" up as test applet:

Quote:
import java.awt.*;
import java.applet.*;
import org.apache.log4j.Logger;

/**
* @author t01dev
*
*/
public class Ploop extends Applet
{
// declare some stuff here
Logger myLogger = Logger.getLogger("Ploop");

public void init()
{

}

public void paint(Graphics g)
{
g.setColor(new Color(100,45,14));
g.drawString("Ploop rules!", 10, 10);
}


}
with this as HTML:

Quote:
<html>
<head>
<title>Ploop test</title>
</head>
<body>
<APPLET CODE="Ploop.class" name="plooptest" WIDTH=400 HEIGHT=100>
</APPLET>
</body>
</html>
the browser (firefox - of course) says "applet not initialised" in the status bar...

What? Where? Huh???

Please help, tnx

Thor
 
Old 04-18-2009, 12:34 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Log4J is great for debugging server-side stuff ... but frankly, I'd just use a simple "MsgBox" popup on your (applet) client:

EXAMPLE:
Code:
import java.awt.*;
...
  JOptionPane.showMessageDialog(this,
    "Howdy!",
    "Debug",
    JOptionPane.INFORMATION_MESSAGE,
    Icon);
IMHO .. PSM
 
Old 04-19-2009, 11:37 AM   #3
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766

Original Poster
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hi,

Hmmmpfff...after H-O-U-R-S of skimming tru tons of lecture, it's possibly the better sollution.

Too bad, If I had a java console as promissed by FireFox's extentions...but that does'nt work. I have "java console" in the tools menu, but nothing happens, so I am/was looking for some way to log an applet...

Eh, who said life is sweet...did'nt try setting up log4j...

Enjoy what is left of your weekend, I will

Thor
 
  


Reply

Tags
applet, java, log4j, logging



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SVNKit+log4j conflict kpachopoulos Programming 0 10-23-2007 03:13 AM
configure syslog with log4j y2j_2062 Linux - Software 1 04-01-2007 12:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration