The problem is that you are redefining the same log category twice. The second
one loading is overwriting the first most likely. Unfortunately, logkit does not support
different log levels for different log targets (At least not that I am aware of :-)
You need to change your categories section as follows:
<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>
Cheers,
Leif
mati wrote:
<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.StreamTargetFactory"/>
</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:[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]>