cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > LogBrowser - Configuration
Date Wed, 25 Aug 2010 12:44:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/LogBrowser+-+Configuration">LogBrowser
- Configuration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~tomekopo">Tomasz
Oponowicz</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >LogBrowser is log entries viewer.
It is rich internet application which can be embedded in your web application. Configure what
log entries you would like to see and view them in your favorite browser. Anytime, anywhere
without using console. Let&#39;s make brief overview how to configure LogbBrowser inside
your application. <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{gallery:title=Screenshots|include=accessControl.png,accessControl-wrongUsernameOrPassword.png,browser.png,settings.png,settings-addEndpoint.png,settings-addEndpoint-emptyFields.png}
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >{tip:title=Documentation} <br>For
more information about LogBrowser go to [software requirements specification (SRS)|CXF20DOC:LogBrowser
- Software Requirements Specification] or [system architectural design (SAD)|CXF20DOC:LogBrowser
- System architectural design] documents. <br>{tip} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h2.
Screenshots <br> <br>!accessControl.png|thumbnail,border=1! !accessControl-wrongUsernameOrPassword.png|thumbnail,border=1!
!browser.png|thumbnail,border=1! !settings.png|thumbnail,border=1! !settings-addEndpoint.png|thumbnail,border=1!
!settings-addEndpoint-emptyFields.png|thumbnail,border=1! <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Configuring LogBrowser application
in container without Spring <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="LogBrowser-Configuration-LogBrowser"></a>LogBrowser</h1>

<p><b>This feature is available in 2.3-SNAPSHOT only, as part of the cxf-rt-management-web
component</b></p>

<p>LogBrowser is log entries viewer. It is rich internet application which can be embedded
in your web application. Configure what log entries you would like to see and view them in
your favorite browser. Anytime, anywhere without using console. Let's make brief overview
how to configure LogbBrowser inside your application.</p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Documentation</b><br
/>For more information about LogBrowser go to <a href="/confluence/display/CXF20DOC/LogBrowser+-+Software+Requirements+Specification"
title="LogBrowser - Software Requirements Specification">software requirements specification
(SRS)</a> or <a href="/confluence/display/CXF20DOC/LogBrowser+-+System+architectural+design"
title="LogBrowser - System architectural design">system architectural design (SAD)</a>
documents.</td></tr></table></div>

<h2><a name="LogBrowser-Configuration-Screenshots"></a>Screenshots</h2>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 1680x518"
href='https://cwiki.apache.org/confluence/download/attachments/23336032/accessControl.png'><img
src="/confluence/download/thumbnails/23336032/accessControl.png" style="border: 1px solid
black" /></a></span> <span class="image-wrap" style=""><a class="confluence-thumbnail-link
1680x518" href='https://cwiki.apache.org/confluence/download/attachments/23336032/accessControl-wrongUsernameOrPassword.png'><img
src="/confluence/download/thumbnails/23336032/accessControl-wrongUsernameOrPassword.png" style="border:
1px solid black" /></a></span> <span class="image-wrap" style=""><a
class="confluence-thumbnail-link 1680x803" href='https://cwiki.apache.org/confluence/download/attachments/23336032/browser.png'><img
src="/confluence/download/thumbnails/23336032/browser.png" style="border: 1px solid black"
/></a></span> <span class="image-wrap" style=""><a class="confluence-thumbnail-link
1680x803" href='https://cwiki.apache.org/confluence/download/attachments/23336032/settings.png'><img
src="/confluence/download/thumbnails/23336032/settings.png" style="border: 1px solid black"
/></a></span> <span class="image-wrap" style=""><a class="confluence-thumbnail-link
1680x803" href='https://cwiki.apache.org/confluence/download/attachments/23336032/settings-addEndpoint.png'><img
src="/confluence/download/thumbnails/23336032/settings-addEndpoint.png" style="border: 1px
solid black" /></a></span> <span class="image-wrap" style=""><a class="confluence-thumbnail-link
1680x803" href='https://cwiki.apache.org/confluence/download/attachments/23336032/settings-addEndpoint-emptyFields.png'><img
src="/confluence/download/thumbnails/23336032/settings-addEndpoint-emptyFields.png" style="border:
1px solid black" /></a></span></p>

<h2><a name="LogBrowser-Configuration-ConfiguringLogBrowserapplicationincontainerwithoutSpring"></a>Configuring
LogBrowser application in container without Spring</h2>

<h5><a name="LogBrowser-Configuration-Step1"></a>Step 1</h5>

<p>Add <tt>cxf-rt-management-web</tt> dependency to your Maven project (if
you don't use Maven as management tool, omit this step and add <tt>cxf-rt-management-web</tt>
library manually):</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>pom.xml</b></div><div class="codeContent
panelContent">
<script type="syntaxhighlighter" class="toolbar: true; theme: Default; brush: xml; gutter:
true"><![CDATA[
&lt;project&gt;

    [...]

    &lt;dependencies&gt;

        [...]

        &lt;dependency&gt;
            &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
            &lt;artifactId&gt;cxf-rt-management-web&lt;/artifactId&gt;
            &lt;version&gt;2.3.0&lt;/version&gt;
        &lt;/dependency&gt;

        [...]

    &lt;/dependencies&gt;

    [...]

&lt;/project&gt;
]]></script>
</div></div>

<h5><a name="LogBrowser-Configuration-Step2"></a>Step 2</h5>

<p>Add new class to your project, <tt>LogBrowserApp</tt>. Add content from
sample below.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>LogBrowserApp.java</b></div><div
class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: true; theme: Default; brush: java; gutter:
true"><![CDATA[
package yourpackage;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Provider;

import org.apache.cxf.jaxrs.provider.AtomEntryProvider;
import org.apache.cxf.jaxrs.provider.AtomFeedProvider;
import org.apache.cxf.management.web.logging.atom.AtomPullServer;
import org.apache.cxf.management.web.logging.logbrowser.bootstrapping.BootstrapStorage;
import org.apache.cxf.management.web.logging.logbrowser.bootstrapping.SimpleAuthenticationFilter;
import org.apache.cxf.management.web.logging.logbrowser.bootstrapping.SimpleXMLSettingsStorage;

@Provider
public class LogBrowserApp extends Application {
	Set&lt;Object&gt; classes = new HashSet&lt;Object&gt;();
	
	static {
        AtomPullServer aps = new AtomPullServer();
        aps.setLoggers("yourpackage:INFO");
        aps.init();

        classes.add(aps);
        classes.add(new AtomFeedProvider());
        classes.add(new AtomEntryProvider());
        classes.add(new BootstrapStorage(new SimpleXMLSettingsStorage()));
        classes.add(new SimpleAuthenticationFilter(new HashMap&lt;String, String&gt;()
{
            {
            	// add all required users by specified username and password, for example: put("admin",
"admin");
            }
        }));
        classes.add(new BootstrapStorage.StaticFileProvider());
        classes.add(new BootstrapStorage.SettingsProvider());
	}
	
    @Override
    public Set&lt;Class&lt;?&gt;&gt; getClasses() {
        return Collections.emptySet();
    }

    @Override
    public Set&lt;Object&gt; getSingletons() {
        return classes;
    }
}
]]></script>
</div></div>

<p>We have to modify newly created class a little bit:</p>
<ul>
	<li>Go to line 1. Replace <tt>yourpackage</tt> phrase with a valid package.</li>
	<li>Go to line 23. Configure which log entries should be caught. If you would like
to catch all log entries related with your application at the INFO level, simply replace <tt>yourpackage</tt>
phrase with your application's package. For more information how to configure custom loggers
go to <a href="/confluence/display/CXF20DOC/JAX-RS" title="JAX-RS">AtomPullServer description</a>.</li>
	<li>Go to line 32. Add all required users. Keep in mind that each user has his own
independent configuration.</li>
</ul>


<h5><a name="LogBrowser-Configuration-Step3"></a>Step 3</h5>

<p>Add new servlet definition to your <tt>web.xml</tt> file, like in sample
below: </p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>web.xml</b></div><div class="codeContent
panelContent">
<script type="syntaxhighlighter" class="toolbar: true; theme: Default; brush: xml; gutter:
true"><![CDATA[
&lt;web-app&gt;

	[...]
	
	&lt;servlet&gt;
		&lt;servlet-name&gt;LogBrowserApp&lt;/servlet-name&gt;
		&lt;display-name&gt;LogBrowserApp&lt;/display-name&gt;
		&lt;servlet-class&gt;
			org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
		&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
			&lt;param-value&gt;yourpackage.LogBrowserApp&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;

	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;LogBrowserApp&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/log/*&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
	
	[...]

&lt;/web-app&gt;	
]]></script>
</div></div>

<p>Go to line 13 and replace <tt>yourpackage</tt> phrase with a valid package.</p>

<h5><a name="LogBrowser-Configuration-Step4"></a>Step 4</h5>

<p>Rebuild and run your application.</p>

<h5><a name="LogBrowser-Configuration-Step5"></a>Step 5</h5>

<p>Open browser and go to URL: </p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-none">http://localhost:9002/log/bootstrapstorage/resources/LogBrowser.html</pre>
</div></div>

<h5><a name="LogBrowser-Configuration-Step6"></a>Step 6</h5>

<p>Add new endpoint with URL: </p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-none">http://localhost:9002/log/logs</pre>
</div></div>

<p>Congratulation. Now you can easily view log enties using LogBrowser. </p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Complete sample</b><br
/>For more details about configuration go to <a href="https://svn.apache.org/repos/asf/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/"
class="external-link" rel="nofollow">sample project</a>.</td></tr></table></div>


    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/LogBrowser+-+Configuration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23336032&revisedVersion=2&originalVersion=1">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/LogBrowser+-+Configuration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message