You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Carsten Hammer <Ca...@t-online.de> on 2004/02/01 23:06:04 UTC

Re: how to use sawchain2?

Thank you Paul, thank you Scott for your explanation.

Your suggestion works for me. What I really want to get is a Dialog that 
pops up from my application (non modal) via a menuitem and that only 
installs its appender if its visible. It should show up exactly the same 
information like a appender configured using a log4jproperties file if 
the user wants and  should not interfere with it. If possible only 
timestamp and messages are shown at default to have a small dialog 
window. Of course it would not hurt if it could then easily be 
configured to look like the full blown chainsaw application. But all 
configuration should be possible programmatically from within my calling 
application. Is this possible?

Best regards,
Carsten
Scott Deboy schrieb:
> 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:paul.smith@lawlex.com.au]
> Sent:	Fri 1/30/2004 4:16 PM
> To:	Log4J Developers List
> Cc:	log4j-dev@jakarta.apache.org; log4j-user@jakarta.apache.org
> 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: log4j-dev-unsubscribe@logging.apache.org
>>For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org