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