| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 --> |
| <title>MonolineFormatter (Apache SIS 1.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2019-09-20"> |
| <meta name="keywords" content="org.apache.sis.util.logging.MonolineFormatter class"> |
| <meta name="keywords" content="getHeader()"> |
| <meta name="keywords" content="setHeader()"> |
| <meta name="keywords" content="getTimeFormat()"> |
| <meta name="keywords" content="setTimeFormat()"> |
| <meta name="keywords" content="getSourceFormat()"> |
| <meta name="keywords" content="setSourceFormat()"> |
| <meta name="keywords" content="getLevelColor()"> |
| <meta name="keywords" content="setLevelColor()"> |
| <meta name="keywords" content="resetLevelColors()"> |
| <meta name="keywords" content="format()"> |
| <meta name="keywords" content="formatMessage()"> |
| <meta name="keywords" content="install()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="MonolineFormatter (Apache SIS 1.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":9,"i7":9,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../../"; |
| var useModuleDirectories = false; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/MonolineFormatter.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.sis.util.logging</a></div> |
| <h2 title="Class MonolineFormatter" class="title">Class MonolineFormatter</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Formatter</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>MonolineFormatter</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <pre>public class <span class="typeNameLabel">MonolineFormatter</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Formatter</a></pre> |
| <div class="block">A formatter writing log messages on a single line. Compared to the JDK <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/SimpleFormatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>SimpleFormatter</code></a>, |
| this formatter uses only one line per message instead of two. For example messages formatted by |
| <code>MonolineFormatter</code> may look like: |
| |
| <blockquote><table style="color:white; background:black" class="compact"> |
| <caption style="color:black">Logging example</caption> |
| <tr><td><code>00:01</code></td><td style="background:blue"><code>CONFIG</code></td> |
| <td><code><b>[MyApplication]</b> Read configuration from “my-application/setup.xml”.</code></td></tr> |
| <tr><td><code>00:03</code></td><td style="background:green"><code>INFO</code></td> |
| <td><code><b>[EPSGFactory]</b> Connected to the EPSG database version 9.1 on Derby 10.14.</code></td></tr> |
| <tr><td><code>00:12</code></td><td style="background:goldenrod"><code>WARNING</code></td> |
| <td><code><b>[DefaultTemporalExtent]</b> This operation requires the “sis-temporal” module.</code></td></tr> |
| </table></blockquote> |
| |
| By default, <code>MonolineFormatter</code> shows only the level and the message. One or two additional |
| fields can be inserted between the level and the message if the <a href="#setTimeFormat(java.lang.String)"><code>setTimeFormat(String)</code></a> or |
| <a href="#setSourceFormat(java.lang.String)"><code>setSourceFormat(String)</code></a> methods are invoked with o non-null argument. Examples: |
| |
| <ul> |
| <li><code>setTimeFormat("HH:mm:ss")</code> for formatting the time like <code>00:00:04"</code>, |
| as time elapsed since the <code>MonolineFormatter</code> creation time.</li> |
| <li><code>setSourceFormat("logger:long")</code> for formatting the full logger name |
| (e.g. <code>"org.apache.sis.storage.netcdf"</code>).</li> |
| <li><code>setSourceFormat("class:short")</code> for formatting the short class name, |
| without package (e.g. <code>"NetcdfStore"</code>).</li> |
| </ul> |
| |
| <div class="section">Configuration from <code>logging.properties</code></div> |
| The format can also be set from the <code>jre/lib/logging.properties</code> file. |
| For example, user can cut and paste the following properties into <code>logging.properties</code>: |
| |
| <blockquote><pre>########################################################################### |
| # Properties for the apache.sis.org's MonolineFormatter. |
| # By default, the monoline formatter display only the level |
| # and the message. Additional fields can be specified here: |
| # |
| # time: If set, writes the time elapsed since the initialization. |
| # The argument specifies the output pattern. For example, the |
| # pattern "HH:mm:ss.SSSS" displays the hours, minutes, seconds |
| # and milliseconds. |
| # |
| # source: If set, writes the source logger name or the source class name. |
| # Valid argument values are "none", "logger:short", "logger:long", |
| # "class:short", "class:long" and "class.method". |
| ########################################################################### |
| org.apache.sis.util.logging.MonolineFormatter.time = HH:mm:ss.SSS |
| org.apache.sis.util.logging.MonolineFormatter.source = class:short</pre></blockquote> |
| |
| See <a href="#setTimeFormat(java.lang.String)"><code>setTimeFormat(String)</code></a> and <a href="#setSourceFormat(java.lang.String)"><code>setSourceFormat(String)</code></a> for more information about the |
| above <code>time</code> and <code>source</code> properties. Encoding and logging level are configured separately, |
| typically on the JDK <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>ConsoleHandler</code></a> like below: |
| |
| <blockquote><pre>java.util.logging.ConsoleHandler.encoding = UTF-8 |
| java.util.logging.ConsoleHandler.level = FINE</pre></blockquote> |
| |
| <div class="section">Thread safety</div> |
| The same <code>MonolineFormatter</code> instance can be safely used by many threads without synchronization |
| on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call |
| from multiple threads.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.3</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/SimpleFormatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>SimpleFormatter</code></a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html?is-external=true#setFormatter(java.util.logging.Formatter)" title="class or interface in java.util.logging" class="externalLink"><code>Handler.setFormatter(Formatter)</code></a></dd> |
| |
| <p><font size="-1">Defined in the <code>sis-utility</code> module</font></p> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">MonolineFormatter</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Constructs a default <code>MonolineFormatter</code>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.util.logging.Handler)">MonolineFormatter</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Handler</a> handler)</code></th> |
| <td class="colLast"> |
| <div class="block">Constructs a <code>MonolineFormatter</code> configured for the given handler.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#format(java.util.logging.LogRecord)">format</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">LogRecord</a> record)</code></th> |
| <td class="colLast"> |
| <div class="block">Formats the given log record and returns the formatted string.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#formatMessage(java.util.logging.LogRecord)">formatMessage</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">LogRecord</a> record)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the localized message from the given log record.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getHeader()">getHeader</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the string to write on the left side of the first line of every log records, or <code>null</code> if none.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLevelColor(java.util.logging.Level)">getLevelColor</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the color used for the given level, or <code>null</code> if none.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSourceFormat()">getSourceFormat</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the format for the source, or <code>null</code> is the source is not shown.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTimeFormat()">getTimeFormat</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the format for elapsed time, or <code>null</code> if the time is not shown.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static <a href="MonolineFormatter.html" title="class in org.apache.sis.util.logging">MonolineFormatter</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#install()">install</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Installs a <code>MonolineFormatter</code> for the root logger, or returns the existing instance if any.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static <a href="MonolineFormatter.html" title="class in org.apache.sis.util.logging">MonolineFormatter</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#install(java.util.logging.Logger,java.util.logging.Level)">install</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Logger</a> logger, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level)</code></th> |
| <td class="colLast"> |
| <div class="block">Installs a <code>MonolineFormatter</code> for the specified logger, or returns the existing instance if any.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#resetLevelColors(boolean)">resetLevelColors</a></span>​(boolean enabled)</code></th> |
| <td class="colLast"> |
| <div class="block">Resets the colors setting to its default value.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setHeader(java.lang.String)">setHeader</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> header)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the string to write on the left side of the first line of every log records.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setLevelColor(java.util.logging.Level,java.lang.String)">setLevelColor</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> color)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the color to use for the given level, or <code>null</code> for removing colorization.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceFormat(java.lang.String)">setSourceFormat</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> format)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the format for displaying the source, or hides the source field.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setTimeFormat(java.lang.String)">setTimeFormat</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> pattern)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the format for elapsed time, or hides the time field.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.Formatter"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Formatter</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true#getHead(java.util.logging.Handler)" title="class or interface in java.util.logging" class="externalLink">getHead</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true#getTail(java.util.logging.Handler)" title="class or interface in java.util.logging" class="externalLink">getTail</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>MonolineFormatter</h4> |
| <pre>public MonolineFormatter()</pre> |
| <div class="block">Constructs a default <code>MonolineFormatter</code>. This no-argument constructor is invoked |
| by the logging system if the <code>logging.properties</code> file contains the following line: |
| |
| <blockquote><pre>java.util.logging.ConsoleHandler.formatter = org.apache.sis.util.logging.MonolineFormatter</pre></blockquote></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="<init>(java.util.logging.Handler)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>MonolineFormatter</h4> |
| <pre>public MonolineFormatter​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Handler</a> handler)</pre> |
| <div class="block">Constructs a <code>MonolineFormatter</code> configured for the given handler. |
| |
| <div class="section">Auto-configuration from the handler</div> |
| Formatters are often associated to a particular handler. If this handler is known, giving it at |
| construction time can help this formatter to configure itself. This handler is only a hint - it |
| will not be modified, and no reference to that handler will be kept by this constructor.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - The handler to be used with this formatter, or <code>null</code> if unknown.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html?is-external=true#setFormatter(java.util.logging.Formatter)" title="class or interface in java.util.logging" class="externalLink"><code>Handler.setFormatter(Formatter)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getHeader()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHeader</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getHeader()</pre> |
| <div class="block">Returns the string to write on the left side of the first line of every log records, or <code>null</code> if none. |
| This is a string to be shown just before the level.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the string to write on the left side of the first line of every log records, or <code>null</code> if none.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setHeader(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setHeader</h4> |
| <pre class="methodSignature">public void setHeader​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> header)</pre> |
| <div class="block">Sets the string to write on the left side of the first line of every log records.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>header</code> - The string to write on the left side of the first line of every log records, |
| or <code>null</code> if none.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getTimeFormat()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTimeFormat</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getTimeFormat()</pre> |
| <div class="block">Returns the format for elapsed time, or <code>null</code> if the time is not shown. |
| This method returns the pattern specified by the last call to the |
| <a href="#setTimeFormat(java.lang.String)"><code>setTimeFormat(String)</code></a> method, or the patten specified by the |
| <code>org.apache.sis.util.logging.MonolineFormatter.time</code> property in the |
| <code>jre/lib/logging.properties</code> file.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the time pattern, or <code>null</code> if elapsed time is not formatted.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setTimeFormat(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setTimeFormat</h4> |
| <pre class="methodSignature">public void setTimeFormat​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> pattern) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></pre> |
| <div class="block">Sets the format for elapsed time, or hides the time field. The pattern must matches the |
| format specified in <a href="https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>SimpleDateFormat</code></a>, but for the time part only (no date). |
| |
| <div class="note"><b>Example:</b> |
| The <code>"HH:mm:ss.SSS"</code> pattern will display the elapsed time in hours, minutes, seconds |
| and milliseconds.</div></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>pattern</code> - the time pattern, or <code>null</code> to disable time formatting.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the given pattern is invalid.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSourceFormat()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSourceFormat</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getSourceFormat()</pre> |
| <div class="block">Returns the format for the source, or <code>null</code> is the source is not shown. |
| This method returns the source format specified by the last call to the |
| <a href="#setSourceFormat(java.lang.String)"><code>setSourceFormat(String)</code></a> method, or the format specified by the |
| <code>org.apache.sis.util.logging.MonolineFormatter.source</code> property in the |
| <code>jre/lib/logging.properties</code> file.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the source format, or <code>null</code> if source is not formatted.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setSourceFormat(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSourceFormat</h4> |
| <pre class="methodSignature">public void setSourceFormat​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> format) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></pre> |
| <div class="block">Sets the format for displaying the source, or hides the source field. |
| The given format can be any of the following values, from more verbose to less verbose: |
| |
| <ul> |
| <li><code>null</code> for hiding the source field.</li> |
| <li><code>"class:long"</code> for the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getSourceClassName()" title="class or interface in java.util.logging" class="externalLink">source class name</a></li> |
| <li><code>"logger:long"</code> for the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getLoggerName()" title="class or interface in java.util.logging" class="externalLink">logger name</a></li> |
| <li><code>"class:short"</code> for the source class name without the package part.</li> |
| <li><code>"logger:short"</code> for the logger name without the package part.</li> |
| <li><code>"class.method"</code> for the short class name followed by the |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getSourceMethodName()" title="class or interface in java.util.logging" class="externalLink">source method name</a></li> |
| </ul> |
| |
| The source class name usually contains the logger name since (by convention) logger |
| names are package names, but this is not mandatory neither enforced.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>format</code> - the format for displaying the source, or <code>null</code> if the source shall not be formatted.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the given argument is not one of the recognized format names.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getLevelColor(java.util.logging.Level)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLevelColor</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getLevelColor​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level)</pre> |
| <div class="block">Returns the color used for the given level, or <code>null</code> if none. |
| The current set of supported colors are <code>"red"</code>, <code>"green"</code>, <code>"yellow"</code>, <code>"blue"</code>, |
| <code>"magenta"</code>, <code>"cyan"</code> and <code>"gray"</code>. This set may be extended in any future SIS version.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>level</code> - the level for which to get the color.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the color for the given level, or <code>null</code> if none.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setLevelColor(java.util.logging.Level,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setLevelColor</h4> |
| <pre class="methodSignature">public void setLevelColor​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> color) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></pre> |
| <div class="block">Sets the color to use for the given level, or <code>null</code> for removing colorization. |
| This method should be invoked only if this formatter is associated to a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>Handler</code></a> |
| writing to a terminal supporting <cite>ANSI escape codes</cite> |
| (a.k.a. ECMA-48, ISO/IEC 6429 and X3.64 standards). |
| |
| <p>The given <code>color</code> argument shall be one of the values documented in the |
| <a href="#getLevelColor(java.util.logging.Level)"><code>getLevelColor(Level)</code></a> method.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>level</code> - the level for which to set a new color.</dd> |
| <dd><code>color</code> - the case-insensitive new color, or <code>null</code> if none.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the given color is not one of the recognized values.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="resetLevelColors(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>resetLevelColors</h4> |
| <pre class="methodSignature">public void resetLevelColors​(boolean enabled)</pre> |
| <div class="block">Resets the colors setting to its default value. |
| |
| <ul> |
| <li>If <code>enabled</code> is <code>true</code>, then this method defines a default set of colors.</li> |
| <li>If <code>enabled</code> is <code>false</code>, then this method resets the formatting to plain text.</li> |
| </ul> |
| |
| This method does not check if <cite>ANSI escape codes</cite> are supported or not. |
| This check must be done by the caller.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>enabled</code> - <code>true</code> for defining a default set of colors, or <code>false</code> for removing all colors.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="format(java.util.logging.LogRecord)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>format</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> format​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">LogRecord</a> record)</pre> |
| <div class="block">Formats the given log record and returns the formatted string. |
| See the <a href="#overview">class javadoc</a> for information on the log format.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true#format(java.util.logging.LogRecord)" title="class or interface in java.util.logging" class="externalLink">format</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Formatter</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>record</code> - the log record to be formatted.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a formatted log record.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="formatMessage(java.util.logging.LogRecord)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>formatMessage</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> formatMessage​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">LogRecord</a> record)</pre> |
| <div class="block">Returns the localized message from the given log record. |
| First this method gets the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getMessage()" title="class or interface in java.util.logging" class="externalLink">raw message</a> from the given record. |
| Then there is choices: |
| |
| <ul> |
| <li>If the given record specifies a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getResourceBundle()" title="class or interface in java.util.logging" class="externalLink">resource bundle</a>, |
| then the message is used as a key for fetching the localized resources in the given bundle.</li> |
| <li>If the given record specifies one or more <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html?is-external=true#getParameters()" title="class or interface in java.util.logging" class="externalLink">parameters</a> |
| and if the message seems to use the <a href="https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>MessageFormat</code></a> syntax, then the message is formatted |
| by <code>MessageFormat</code>.</li> |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true#formatMessage(java.util.logging.LogRecord)" title="class or interface in java.util.logging" class="externalLink">formatMessage</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Formatter.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Formatter</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>record</code> - The log record from which to get a localized message.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the localized message.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="install()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>install</h4> |
| <pre class="methodSignature"><a href="../Configuration.html" title="annotation in org.apache.sis.util">@Configuration</a> |
| public static <a href="MonolineFormatter.html" title="class in org.apache.sis.util.logging">MonolineFormatter</a> install() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityException.html?is-external=true" title="class or interface in java.lang" class="externalLink">SecurityException</a></pre> |
| <div class="block">Installs a <code>MonolineFormatter</code> for the root logger, or returns the existing instance if any. |
| This method performs the following choices: |
| |
| <ul> |
| <li>If a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>ConsoleHandler</code></a> is associated to the root logger, then: |
| <ul> |
| <li>If that handler already uses a <code>MonolineFormatter</code>, then the existing formatter is returned.</li> |
| <li>Otherwise the <code>ConsoleHandler</code> formatter is replaced by a new <code>MonolineFormatter</code> instance, |
| and that new instance is returned. We perform this replacement in order to avoid sending twice the same |
| records to the console.</li> |
| </ul></li> |
| <li>Otherwise a new <code>ConsoleHandler</code> using a new <code>MonolineFormatter</code> is created and added to the |
| root logger.</li> |
| </ul> |
| |
| <div class="note"><b>Implementation note:</b> |
| The current implementation does not check for duplicated <code>ConsoleHandler</code> instances, |
| and does not check if any child logger has a <code>ConsoleHandler</code>.</div></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the new or existing <code>MonolineFormatter</code>. The formatter output can be configured |
| using the <a href="#setTimeFormat(java.lang.String)"><code>setTimeFormat(String)</code></a> and <a href="#setSourceFormat(java.lang.String)"><code>setSourceFormat(String)</code></a> methods.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityException.html?is-external=true" title="class or interface in java.lang" class="externalLink">SecurityException</a></code> - if this method does not have the permission to install the formatter.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="install(java.util.logging.Logger,java.util.logging.Level)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>install</h4> |
| <pre class="methodSignature"><a href="../Debug.html" title="annotation in org.apache.sis.util">@Debug</a> |
| <a href="../Configuration.html" title="annotation in org.apache.sis.util">@Configuration</a> |
| public static <a href="MonolineFormatter.html" title="class in org.apache.sis.util.logging">MonolineFormatter</a> install​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Logger</a> logger, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging" class="externalLink">Level</a> level) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityException.html?is-external=true" title="class or interface in java.lang" class="externalLink">SecurityException</a></pre> |
| <div class="block">Installs a <code>MonolineFormatter</code> for the specified logger, or returns the existing instance if any. |
| This method performs the following steps: |
| |
| <ul> |
| <li>If a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>ConsoleHandler</code></a> is associated to the given logger, then: |
| <ul> |
| <li>If that handler already uses a <code>MonolineFormatter</code>, then the existing formatter is returned.</li> |
| <li>Otherwise the <code>ConsoleHandler</code> formatter is replaced by a new <code>MonolineFormatter</code> instance, |
| and that new instance is returned. We perform this replacement in order to avoid sending twice the same |
| records to the console.</li> |
| </ul></li> |
| <li>Otherwise: |
| <ul> |
| <li>The <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html?is-external=true#setUseParentHandlers(boolean)" title="class or interface in java.util.logging" class="externalLink"><code>Logger.setUseParentHandlers(boolean)</code></a> flag is set to <code>false</code> for avoiding duplicated |
| loggings if a <code>ConsoleHandler</code> instance exists in the parent handlers.</li> |
| <li>Parent handlers that are not <code>ConsoleHandler</code> instances are added to the given logger in |
| order to preserve similar behavior as before the call to <code>setUseParentHandlers(false)</code>.</li> |
| <li>A new <code>ConsoleHandler</code> using a new <code>MonolineFormatter</code> is created and added to the |
| given logger.</li> |
| </ul></li> |
| </ul> |
| |
| <div class="note"><b>Implementation note:</b> |
| The current implementation does not check for duplicated <code>ConsoleHandler</code> instances, |
| and does not check if any child logger has a <code>ConsoleHandler</code>.</div> |
| |
| <div class="section">Specifying a log level</div> |
| This method can opportunistically set the handler level. If the given level is non-null, |
| then the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html?is-external=true" title="class or interface in java.util.logging" class="externalLink"><code>ConsoleHandler</code></a> using the <code>MonolineFormatter</code> will be set to that level. |
| This is mostly a convenience for temporary increase of logging verbosity for debugging purpose. |
| This functionality should not be used in production environment, since it overwrite user's level setting.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>logger</code> - the base logger to apply the change on.</dd> |
| <dd><code>level</code> - the desired level, or <code>null</code> if no level should be set.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the new or existing <code>MonolineFormatter</code>. The formatter output can be configured |
| using the <a href="#setTimeFormat(java.lang.String)"><code>setTimeFormat(String)</code></a> and <a href="#setSourceFormat(java.lang.String)"><code>setSourceFormat(String)</code></a> methods.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityException.html?is-external=true" title="class or interface in java.lang" class="externalLink">SecurityException</a></code> - if this method does not have the permission to install the formatter.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/MonolineFormatter.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2010–2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |