You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ron Grabowski <ro...@yahoo.com> on 2005/09/15 01:06:31 UTC

Changing the default detail layout in Chainsaw on a per plugin basis

Can non-log4j nodes be in a Chainsaw config file? Does Chainsaw have an
API for retrieving nodes outside of log4j:configuration when a config
file is specified?

I'm currently using the following plugin to configure Chainsaw:

 <plugin name="UDPReceiver" class="org.apache.log4j.net.UDPReceiver">
  <param name="Port" value="8080" />
 </plugin>

I don't like the default detail layout:

http://tinyurl.com/bmugn
http://cvs.apache.org/viewcvs.cgi/logging-chainsaw/src/java/org/apache/log4j/chainsaw/layout/DefaultDetailLayout.html

I would like to add support to Chainsaw to allow a detail layout to be
specified via a parameter passed to a plugin. If I were in log4net
land, I would start out doing something like this:

 <plugin name="UDPReceiver" class="org.apache.log4j.net.UDPReceiver">
  <port value="8080" />
  <defaultDetailLayout>
   <![CDATA[
<html><body><table cellspacing=2 cellpadding=4>
<TR><TD><B>Level</B></TD><TD>%p</td></tr>
<TR><TD><B>Logger</B><TD>%c</td></tr>
</table><br /><br />%m</body></html>
   ]]>
  </defaultDetailLayout>
 </plugin>

Does log4j support CDATA nodes within its xml config file?

Does log4j only support this style of parameters:

 <param name="Port" value="8080" />

Yes, I know that UDPReceiver shouldn't have a defaultDetailLayout
property on it. Any ideas on where I could store the CDATA node? I
thought about this:

 <plugin name="UDPReceiver" class="DetailLayoutUDPReceiver">
  <port value="8080" />
  <detailLayout>
   <![CDATA[
<html><body><table cellspacing=2 cellpadding=4>
<TR><TD><B>Level</B></TD><TD>%p</td></tr>
<TR><TD><B>Logger</B><TD>%c</td></tr>
</table><br /><br />%m</body></html>
   ]]>
  </detailLayout>
 </plugin>

But Chainsaw would never know that a plugin has a detailLayout node
property set...

What if I wanted specify a default detail layout for every plugin used
in Chainsaw?

Thanks,
Ron

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