I use <priority-filter> to achieve what you want. Bascially the targets are nested inside the priority filter tags and you can put both log-targets under the same category. This may not be the only way or the best way, but it works.
See below. Cheers Steve <factories> <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/> <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/> </factories> <categories> <category name="model-runner" log-level="DEBUG"> <log-target id-ref="model-runner-target"/> <log-target id-ref="model-runner-target-info"/> </category> </categories> <targets> <priority-filter id="model-runner-target" log-level="INFO"> <file> <filename>${app.home}/logs/model-runner.log</filename> <format>%{time:dd/MM/yy HH:mm:ss} %5.5{priority} %{category}:%{message}\n%{throwable}</format> <append>true</append> </file> </priority-filter> <priority-filter id="model-runner-target-info" log-level="INFO"> <stream> <stream>System.out</stream> <format type="avalon">%{time: HH:mm.ss:SSS} %{class:short}: %{message} \n</format> </stream> </priority-filter> </targets> > -----Original Message----- > From: mati [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 22, 2002 9:22 AM > To: Avalon-Phoenix Developers List > Subject: Re: How to enable console logging in Phoenix > > > > > > <logs version="1.1"> > > <!--+ FACTORIES > > + Factories define various types of output targets for log > > messages > > +--> > > <factories> > > <factory type="stream" > > > class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory" > > / > </factories> <!--+ TARGETS > > + Targets are named destinations of log events. Tag > names for > > child > > + elements, such as 'file' or 'screen', correspond > to factory > > types above. > > +--> > > <targets> > > <!-- Outputs events to the screen. --> > > <stream id="sout"> > > <stream>System.out</stream> > > <format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd) > > HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}: > > %{message}\n%{throwable}</format> > > </stream> > > </targets> > > <!--+ CATEGORIES > > + Categories are named sinks for the application to output > > events to. > > + First level category names correspond to block names in > > assembly.xml. > > + > > + Each category has an attribute named log-level that > > controls the severity > > + of messages to records. Valid severities are: > > + DEBUG, INFO, WARN, ERROR, FATAL_ERROR > > + > > + Each category can have children of other categories, and > > log-target elements > > + log-target elements have an id-ref attribute that > > references the id of a target > > + in the targets section. > > +--> > > <categories> > > <!-- anything that doesn't fit into the above categories falls into > > here --> > > <category name="" log-level="DEBUG"> > > <log-target id-ref="sout"/> > > </category> > > </categories> > > </logs> > > > I am trying to log to two targets at the same time and it > fails. It just logs to one or another. Here is sample conf: > > <factories> > <factory type="file" > class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/> > <factory type="stream" > class="org.apache.avalon.excalibur.logger.factory.StreamTarget > Factory"/> > </factories> > > <categories> > > <category name="model-runner" log-level="DEBUG"> > <log-target id-ref="model-runner-target"/> > </category> > > <category name="model-runner" log-level="INFO"> > <log-target id-ref="model-runner-target-info"/> > </category> > > </categories> > > > <targets> > > <file id="model-runner-target"> > <filename>${app.home}/logs/model-runner.log</filename> > <format>%{time:dd/MM/yy HH:mm:ss} %5.5{priority} %{category}: > %{message}\n%{throwable} </format> > <append>true</append> > </file> > > <stream id="model-runner-target-info"> > <stream>System.out</stream> > <format type="avalon">%{time: HH:mm.ss:SSS} > %{class:short}: %{message} \n</format> </stream> </targets> > > > And it doesn't seem to work out > > Could somebody help me solve this so that it is logged to > console and to file. > > Is it even possible to use two targets at the same time > > Mateusz Szczap > [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: > <mailto:avalon-phoenix-dev-> [EMAIL PROTECTED]> > > For additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>