Re: [Quickfix-developers] Dual LogFactory
Brought to you by:
orenmnero
From: Joerg T. <Joe...@ma...> - 2005-03-04 17:11:12
|
Hi Alvin, > Hi, can I have 2 LogFactory working at the same time. For example, one > is MySQLLogFactory and the other is ScreenLogFactory. I found that will > be quite useful. Since you can define your own log factory, you could just define one which in turn logs both to the MySQLLogFactory and the ScreenLogFactory. In Java: public class DualLogFactory implements LogFactory { private LogFactory lf1; private LogFactory lf2; public DualLogFactory( LogFactory lf1, LogFactory lf2 ) { this.lf1=lf1; this.lf2=lf2; } public Log create( SessionID sessionID ) { return new DualLog( lf1.create( sessionID ), lf2.create( sessionID ) ); } } public class DualLog implements Log { Log l1; Log l2; public DualLog( Log l1, Log l2 ) { this.l1 = l1; this.l2 = l2; } public void onIncoming( String text ) { l1.onIncoming( text ); l2.onIncoming( text ); } ... } Hope that helps. Cheers, Jörg -- Joerg Thoennes http://macd.com Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen |