[ 
https://issues.apache.org/jira/browse/LOG4J2-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13589349#comment-13589349
 ] 

Scott Deboy edited comment on LOG4J2-155 at 2/28/13 8:46 AM:
-------------------------------------------------------------

I have uploaded a developer snapshot of Chainsaw which can automatically 
process log4j2 fileappender entries advertised via MulticastDNS.

Chainsaw developer snapshot available here: http://people.apache.org/~sdeboy

In order to try it out, pull down JmDNS (http://jmdns.sourceforge.net) and add 
to your classpath, then modify a configuration to look like this (advertiser 
set on configuration element, advertise set on File element):

You will need to modify the advertiseURI to be a valid file:/ path or http:// 
path accessible to Chainsaw.

<configuration 
advertiser="org.apache.logging.log4j.core.net.MulticastDNSAdvertiser">
...
</configuration>
<appenders>
  <File name="File1" fileName="target/test.log" bufferedIO="false" 
advertiseURI="http://path/to/output.log"; advertise="true">
  ...
  </File>
</appenders>

Then generate some events, resulting in a log file, and while that appender is 
active, start Chainsaw and select the ZeroConf tab, and double-click on the row 
representing the file appender.

A new tab in Chainsaw should appear, displaying the logging events for that 
appender, correctly parsed.

                
      was (Author: sdeboy):
    I have uploaded a developer snapshot of Chainsaw which can automatically 
process log4j2 fileappender entries advertised via MulticastDNS.

Chainsaw developer snapshot available here: http://people.apache.org/~sdeboy

In order to try it out, pull down JmDNS (http://jmdns.sourceforge.net) and add 
to your classpath, then modify a configuration to look like this (advertiser 
set on configuration element, advertise set on File element):

<configuration 
advertiser="org.apache.logging.log4j.core.net.MulticastDNSAdvertiser">
...
</configuration>
<appenders>
  <File name="File1" fileName="target/test.log" bufferedIO="false" 
advertiseURI="http://path/to/output.log"; advertise="true">
  ...
  </File>
</appenders>

Then generate some events, resulting in a log file, and while that appender is 
active, start Chainsaw and select the ZeroConf tab, and double-click on the row 
representing the file appender.

A new tab in Chainsaw should appear, displaying the logging events for that 
appender, correctly parsed.

                  
> add getFormat to Layout
> -----------------------
>
>                 Key: LOG4J2-155
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-155
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Scott Deboy
>         Attachments: log4j2-155-feb21-rev1.patch, 
> log4j2-155-feb24-rev1.patch, log4j2-155-jan22-rev1.patch, 
> log4j2-155-jan23-rev1.patch
>
>
> I was looking at an old rev - getContentType is now exposed - thanks!
> Now if we could add a 'getFormat':
> It would be useful to expose information about a Layout's format.
> If the content type is text/plain, exposing the layout format as a conversion 
> pattern would work fine.
> If the content type is text/html or text/xml we could expose something else 
> (or null).
> My primary interest is adding the ability to 'discover' the file-based 
> logging configurations in order to support them via Chainsaw and multicast 
> DNS.
> If all Layouts supporting text/plain content types exposed their format as a 
> conversion pattern, and the file-based appenders (optionally) provided the 
> ability to advertise their configuration, the files could be remotely tailed 
> without the far endpoint even knowing anything about the file configuration.
> For an example, see how multicast appenders are exposed via 
> zeroconf/multicast dns in log4j 1.x in activateOptions - something very 
> similar could be done with contenttype and format properties in a 
> fileappender with a layout.
>     if (advertiseViaMulticastDNS) {
>         Map properties = new HashMap();
>         properties.put("multicastAddress", remoteHost);
>         zeroConf = new ZeroConfSupport(ZONE, port, getName(), properties);
>         zeroConf.advertise();
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to