If you're interested in launching Chainsaw2 when your app starts, you could launch is 
as an appender:

appender: org.apache.log4j.chainsaw.ChainsawAppender
viewerClass param: org.apache.log4j.chainsaw.LogUI

Take care,
Scott



-----Original Message-----
From:   Paul Smith [mailto:[EMAIL PROTECTED]
Sent:   Fri 1/30/2004 4:16 PM
To:     Log4J Developers List
Cc:     [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject:        Re: how to use sawchain2?
Try:

org.apache.log4j.chainsaw.LogUI.createChainsawGUI(ApplicationPreferenceModel model,
    Action shutdownAction) 

method.

You will need an instance of the ApplicationPreferenceModel (create a
blank one in code and customise it if you need it) and a Swing Action
that can handle when the user chooses to "exit" chainsaw. 

The default action will exit the VM so you should provide an Action that
hides the LogUI frame.  You will also then need in your app a way to
make the LogUI frame visible again.

cheers,

Paul Smith


On Sat, 2004-01-31 at 09:24, Carsten Hammer wrote:
> Hi,
> I tried to instantiate ChainsawCentral like this:
> 
> import java.awt.*;
> import javax.swing.*;
> import org.apache.log4j.chainsaw.plugins.*;
> 
> public class LoggingDialog extends JDialog {
>    private JPanel panel1 = new JPanel();
>    private BorderLayout borderLayout1 = new BorderLayout();
>    private ChainsawCentral chainsaw = new 
> org.apache.log4j.chainsaw.plugins.ChainsawCentral();
> 
> 
>    public LoggingDialog(Frame frame, String title, boolean modal) {
>      super(frame, title, modal);
>      try {
>        jbInit();
>        pack();
>      }
>      catch(Exception ex) {
>        ex.printStackTrace();
>      }
>    }
> 
>    public LoggingDialog() {
>      this(null, "", false);
>    }
>    private void jbInit() throws Exception {
> 
>      panel1.setLayout(borderLayout1);
>      getContentPane().add(panel1);
>      panel1.add(chainsaw, BorderLayout.NORTH);
> 
>    }
> }
> 
> Unfortunatly it does not work. I get the Dialog but there are no logs 
> written to it.
> I tried doing things like
> 
> BasicConfigurator.configure(new 
> org.apache.log4j.chainsaw.ChainsawAppender());
> org.apache.log4j.Logger.getRootLogger().addAppender(new 
> org.apache.log4j.chainsaw.ChainsawAppender());
> 
> before and added a org.apache.log4j.netSocketAppender to my 
> log4j.properties nothing helped.
> 
> This all using log4j-1.3alpha.jar and log4j-chainsaw-1.3alpha.jar.
> 
> Has anybody here been able to use chainsaw within a custom application?
> How?
> Best regards,
> Carsten
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to