Matt (and anyone else), I have checked in some changes to CVS that implement the below. If you want, you can try it out and provide feedback. Since your scenario is a real one, it'll be better than any test bed I can come up with, so I would appreciate if you could give it a whirl.
See the setShutdownAction(Action) method in LogUI now. cheers, Paul Smith On Thu, 2003-08-07 at 08:36, Paul Smith wrote: > Hi Matt, > > Firstly, welcome back from your vacation! > > I think a small ShutdownListener style notification mechanism is a good > idea, for the _notification_, but I think an additional separate method > to register THE shutdown action is probably the way to go. i.e. > > public interface ShutdownListener{ > public void shuttingDown(); > } > > public class LogUI{ > ... > > public void setShutdownAction(Action action){ > this.shutdownAction=action; > } > } > > This deals with the notification of shutdown for interested parties that > want to do something prior to shutdown, and separates it from the actual > shutting down action. The LogUI class can just have a default > SystemShutdownAction configured by default. We can also have a > setShutdownAction(String className) method so that it can be configured > via log4j.xml|properties which converts to a class name on > activateOptions(). > > Comments anyone? > > Also apologise for the lack of time to work on Chainsaw lately, but I'm > not far away from having some more free time. > > cheers, > > Paul Smith > > > On Thu, 2003-08-07 at 01:28, Matt Munz wrote: > > Paul, > > > > I just took a look at the Chainsaw v2 code. LogUI.java, line 764[1] > > would have to be changed to meet my needs. Just a thought -- one way to > > do it would be to use an event mechanism. My app could use a > > NullShutdownListener, and the standalone app could use a > > SystemExitShutdownListener.[2] Perhaps this is overkill... > > > > [1] System.exit(0); > > [2] The code might look something like this: > > LogUI() > > { > > ... > > addShutdownListener(new NullShutdownListener()); > > } > > ... > > main(...) > > { > > ... > > logUI.addShutdownListener(new SystemExitShutdownListener()); > > } > > ... > > shutdown() > > { > > ... > > notifyShutdownListeners(); > > } > > > > - Matt > > > > -----Original Message----- > > From: Paul Smith [mailto:[EMAIL PROTECTED] > > Sent: Thursday, July 10, 2003 10:48 PM > > To: 'Log4J Developers List' > > Subject: RE: Patch: Override ExitAction in Chainsaw > > > > > > We will definately take your points into consideration, as they are > > quite valid. In fact, probably right now Chainsaw v2 is violating the > > somewhat hidden contract of the ChainsawViewer interface (this is how > > you can get the new Log4UI GUI class to popup if you specify it as an > > appender in a log4j configuration file). Under this circumstance also, > > an "exit" action is really an indication that the user is finished with > > the gui, not necessarily finished with the VM. > > > > Perhaps we could define an configuration option for Chainsaw which > > defines the class name of the Exit action, much the same way you define > > the Layout class for an appender. For your code, we could allow you to > > just do this under Chainsaw 2: > > > > ... > > > > LogUI logUI = LogUI.createForInVM(); > > > > logUI.setExitAction(myExitAction); > > logUI.activateViewer(); > > ... > > > > Oh, and have a great vacation! > > > > Thanks again, > > > > Paul > > > > -----Original Message----- > > From: Matt Munz [mailto:[EMAIL PROTECTED] > > Sent: Friday, 11 July 2003 11:45 AM > > To: Log4J Developers List > > Subject: RE: Patch: Override ExitAction in Chainsaw > > > > > > Paul, > > > > I'm going on vacation and won't be able to look at Chainsaw v2 until > > next month :( > > > > For my application, the primary feature I'd like to see is the ability > > to treat Chainsaw as a software component, rather than just as a > > standalone application. This means making sure that System.exit() is > > never called, or is limited to one overrideable point, as indicated in > > the patch I sent. > > > > Just as log4j is embedded within my application, it makes sense to me > > that a log4j GUI would be embedded in the GUI for my application. The > > more OO/componetized Chainsaw is, the better for my purposes. This would > > also be useful in embedding Chainsaw in other applications like IDEs and > > server administration consoles. Something as simple as a ChainsawPanel > > that I could add to my GUI would be really cool... > > > > BTW, I just had my first use for NDC -- whoever is responsible for > > this design, thanks -- it's always nice to find a generic solution that > > actually fits my specific problem... > > > > - Matt > > -----Original Message----- > > From: Paul Smith [mailto:[EMAIL PROTECTED] > > Sent: Thu 7/10/2003 7:17 PM > > To: 'Log4J Developers List' > > Cc: > > Subject: RE: Patch: Override ExitAction in Chainsaw > > > > > > Hi Matt, > > > > Thanks for the patch, but unfortunately the old Chainsaw is now replaced > > with the new version in CVS, so I don't think I can apply this one. I'm > > not aware of any discussion of an interim 1.2.9 release, I think we're > > just working our way towards 1.3. > > > > I haven't had a chance to do much Chainsaw v2 work lately, but if you > > are game, perhaps you could try out the new Chainsaw running in-Vm with > > your app? I think I have some spare mental-bandwidth at the moment to > > help out with any issues you have. You're scenario would be a good test > > for us, as I don't think we've done much testing along this line, and I > > would be really keen to ensure it works really well. > > > > cheers, > > > > Paul Smith > > > > > -----Original Message----- > > > From: Matt Munz [mailto:[EMAIL PROTECTED] > > > Sent: Friday, 11 July 2003 8:39 AM > > > To: [EMAIL PROTECTED] > > > Subject: Patch: Override ExitAction in Chainsaw > > > > > > > > > Hi all, > > > > > > This is probably fixed in the latest Chainsaw, but I thought I'd > > > forward this patch against 1.2.8 anyway. In the two attached files, > > > the only change is to allow one to pass in the Action object that is > > > registered with close events. I needed this functionality to run > > > Chainsaw in-VM with my application. > > > > > > BTW, will there be a 1.2.9 release including the Chainsaw changes, > > > or will I have to wait for 1.3? > > > > > > - Matt > > > > > > > > > > > > > --------------------------------------------------------------------- > > 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] > > > > > > --------------------------------------------------------------------- > > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]