1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Logback-beagle</title>
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<link rel="stylesheet" type="text/css" href="../css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/_print.css" media="print" />
<link rel="stylesheet" type="text/css" href="../css/prettify.css" media="screen" />
</head>
<body onload="prettyPrint(); decorate();">
<script type="text/javascript">prefix='../';</script>
<script type="text/javascript" src="../js/prettify.js"></script>
<script type="text/javascript" src="../templates/header.js"></script>
<script type="text/javascript" src="../js/dsl.js"></script>
<script type="text/javascript" src="../js/jquery-min.js"></script>
<script type="text/javascript" src="../js/decorator.js"></script>
<div id="left">
<noscript>Please turn on Javascript to view this menu</noscript>
<script src="../templates/left.js" type="text/javascript"></script>
</div>
<div id="content">
<img style="float:left; margin-right: 1em;" src="images/sailing-ship-128x128.png" alt=""/>
<h1>Logback-beagle</h1>
<script src="../templates/creative.js" type="text/javascript"></script>
<h2 class="doAnchor">Logback-beagle: an Eclipse plug-in for
viewing logs</h2>
<p>During the development process, it is common for developers to
print logging events on the console. Typically, the developer will
also customize the format of the log output by setting an
appropriate layout pattern. Logback-beagle is intended as a
replacement for viewing logs via the console. It offers several
advantages over the plain-old console:
</p>
<ul>
<li>Events of level WARN and ERROR are marked by an orange flag
and respectively a red flag.</li>
<li>Quickly jump to the class and line where a given logging
request originated
</li>
<li>Easly view and jump to the callers of any log statement upto
eight levels deep</li>
<li>Change the output format on-the-fly</li>
<li>quickly filter-out events by setting the level of existing
loggers</li>
<li>Measure the time elapsed between any two lines of log</li>
</ul>
<h2 class="doAnchor">Plug-in Installation</h2>
<p>The logback-beagle plug-in requires the Nebula Grid plug-in
which must be installed first.</p>
<dl>
<dt>Step 1: Nebula Grid</dt>
<dd>
<p>The Nebula Grid plug-in which can be installed from
<b>http://download.eclipse.org/technology/nebula/snapshot/</b>. Only
the "Nebula Grid Feature" needs to be installed.</p>
<p><img src="images/nebulaFeature.png" alt=""/></p>
</dd>
<dt>Step 2: Logbak-beagle</dt>
<dd><p>The logback-beagle plug-in can be installed from
<b>http://logback.qos.ch/p2/</b>. You need to select "Logback",
"Logback Beagle" and "SLF4J" bundles for installation as shown
below.</p>
<p><img src="images/beagleFeature.png" alt=""/></p>
</dd>
</dl>
<p>Restarting Eclipse should load the plugin. To access the Beagle
View, either type A"lt-Shift-Q, Q" or select: <em>Window > Show
view > Other... </em>. You should see the <em>Beagle</em> view
nested in the <em>Logback</em> category. Selecting this view will
add it to your workspace. It shouls looks as follows:</p>
<p><img src="images/beagleView0.png" alt=""/></p>
<h3>Configuring the client (logback.xml)</h3>
<p>A single additional configuration line in <em>logback.xml</em>
is sufficient to send log events from your application to
logback-beagle.
</p>
<pre class="prettyprint source"><configuration debug="true">
<!-- sends logs to logback-beagle -->
<b><consolePlugin /></b>
</configuration></pre>
<p>Under the hood, <code><consolePlugin></code> element creates
a <code>SocketAppender</code> which will send logging events to a
TCP socket on <code>localhost</code> port
<em>4321</em>. Logback-beagle launches the corresponding server
listening on this port on localhost.
</p>
<h2 class="doAnchor" name="using">Using logback-beagle</h2>
<p>Logback-beagle displays the events it receives in a table
according to the layout format chosen by the user. Here is a screen
shot of the Beagle View containing logging events.
</p>
<img src="images/beagleSample.png" alt=""/>
<p>Clicking on any log line will scroll-lock (freeze) the
view. Double clicking on that same line will release the scroll
lock (unfreeze) the view. You can also release the scroll lock by
clicking on <img src="images/play_doc.gif" alt="" style="display:
inline;"/>. This icon becomes active (clickable) when the view is
frozen.
</p>
<h3 class="doAnchor" name="using">Jump to caller/Expand caller data</h3>
<p>Right-clicking on any line will reveal the following menu:</p>
<p><img src="images/menu.png" alt=""/></p>
<p>Selecting "Jump to caller" will move the edit cursor to the file
and line number whence the logging statement issued.</p>
<p>Selecting "Expand caller data" will reveal the stack trace of
method calls upto eight levels deep. Here is a sample
screen-shot:</p>
<p><img src="images/callerData.png" alt=""/></p>
<p>Not only are the callers of the log statement revealed, it
becomes possible to jump to any of the listed callers. Right-click
on a caller line. A menu will appear. Select "Jump to caller" in
the menu to jump to the caller of your choice.
</p>
<p><img src="images/callerData-jump.png" alt=""/></p>
<p>Caller data can be collapsed by selecting "Collapse caller
data" from the said menu.</p>
<h2 class="doAnchor">Preferences</h2>
<p>Logback-beagle preferences can be found under the "Beagle"
label nested under "Run/Debug" category. You can customize the
output pattern to best suit your preferences. Changes take effect
immediately.
</p>
<p><img src="images/preferences.png" alt=""/></p>
<p>You may also change the font type and size used for displaying
the log events via the Eclipse's preferences dialog as shown
below:</p>
<p><img src="images/font.png" alt=""/></p>
<script src="templates/footer.js" type="text/javascript"></script>
</div>
</body>
</html>
|