- Timestamp:
- 2014-02-14T16:08:08+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6806 r6852 282 282 283 283 /** 284 * Determines if debug log level is enabled. 285 * Useful to avoid costly construction of debug messages when not enabled. 286 * @return {@code true} if log level is at least debug, {@code false} otherwise 287 * @since 6852 288 */ 289 public static boolean isDebugEnabled() { 290 return logLevel >= 4; 291 } 292 293 /** 294 * Determines if trace log level is enabled. 295 * Useful to avoid costly construction of trace messages when not enabled. 296 * @return {@code true} if log level is at least trace, {@code false} otherwise 297 * @since 6852 298 */ 299 public static boolean isTraceEnabled() { 300 return logLevel >= 5; 301 } 302 303 /** 284 304 * Prints a formatted error message if logging is on. Calls {@link MessageFormat#format} 285 305 * function to format text. … … 595 615 final long startTime = System.currentTimeMillis(); 596 616 initialize(); 597 final long elapsedTime = System.currentTimeMillis() - startTime; 598 Main.debug(tr("{0} completed in {1}", name, Utils.getDurationString(elapsedTime))); 617 if (isDebugEnabled()) { 618 final long elapsedTime = System.currentTimeMillis() - startTime; 619 Main.debug(tr("{0} completed in {1}", name, Utils.getDurationString(elapsedTime))); 620 } 599 621 return null; 600 622 } … … 660 682 return getEditLayer().data; 661 683 } 662 684 663 685 /** 664 686 * Replies the current selected primitives, from a end-user point of view. … … 666 688 * Indeed, if the user is currently in drawing mode, only the way currently being drawn is returned, 667 689 * see {@link DrawAction#getInProgressSelection()}. 668 * 690 * 669 691 * @return The current selected primitives, from a end-user point of view. Can be {@code null}. 670 692 * @since 6546 … … 1421 1443 * Adds a new network error that occur to give a hint about broken Internet connection. 1422 1444 * Do not use this method for errors known for sure thrown because of a bad proxy configuration. 1423 * 1445 * 1424 1446 * @param url The accessed URL that caused the error 1425 1447 * @param t The network error … … 1441 1463 * Adds a new network error that occur to give a hint about broken Internet connection. 1442 1464 * Do not use this method for errors known for sure thrown because of a bad proxy configuration. 1443 * 1465 * 1444 1466 * @param url The accessed URL that caused the error 1445 1467 * @param t The network error -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6830 r6852 308 308 initializeTests(getTests()); 309 309 testsInitialized = true; 310 final long elapsedTime = System.currentTimeMillis() - startTime; 311 Main.debug("Initializing validator tests completed in " + Utils.getDurationString(elapsedTime)); 310 if (Main.isDebugEnabled()) { 311 final long elapsedTime = System.currentTimeMillis() - startTime; 312 Main.debug("Initializing validator tests completed in " + Utils.getDurationString(elapsedTime)); 313 } 312 314 } 313 315 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r6798 r6852 259 259 wait(1000); 260 260 } catch (InterruptedException e) { 261 // Occurs frequently during JOSM shutdown, log set to debugonly262 Main. debug("InterruptedException in "+MapStatus.class.getSimpleName());261 // Occurs frequently during JOSM shutdown, log set to trace only 262 Main.trace("InterruptedException in "+MapStatus.class.getSimpleName()); 263 263 } 264 264 ms.modifiers = mouseState.modifiers; -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r6840 r6852 687 687 errorHeader = activeConnection.getHeaderField("Error"); 688 688 Main.error("Error header: " + errorHeader); 689 } else if (retCode != 200&& responseBody.length()>0) {689 } else if (retCode != HttpURLConnection.HTTP_OK && responseBody.length()>0) { 690 690 Main.error("Error body: " + responseBody); 691 691 } 692 692 activeConnection.disconnect(); 693 694 if (Main.isDebugEnabled()) { 695 Main.debug("RESPONSE: "+ activeConnection.getHeaderFields()); 696 } 693 697 694 698 errorHeader = errorHeader == null? null : errorHeader.trim(); … … 723 727 } 724 728 throw new OsmTransferException(e); 725 } catch(IOException e) {729 } catch(IOException e) { 726 730 throw new OsmTransferException(e); 727 } catch(OsmTransferCanceledException e) {731 } catch(OsmTransferCanceledException e) { 728 732 throw e; 729 733 } catch(OsmTransferException e) { -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r6803 r6852 158 158 } 159 159 try { 160 Main.debug(activeConnection.getHeaderFields().toString()); 160 if (Main.isDebugEnabled()) { 161 Main.debug("RESPONSE: "+activeConnection.getHeaderFields()); 162 } 161 163 if (activeConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) 162 164 throw new OsmApiException(HttpURLConnection.HTTP_UNAUTHORIZED,null,null); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6830 r6852 749 749 connection.setRequestProperty("Connection", "close"); 750 750 } 751 if (Main.isDebugEnabled()) { 752 try { 753 Main.debug("REQUEST: "+ connection.getRequestProperties()); 754 } catch (IllegalStateException e) { 755 Main.warn(e); 756 } 757 } 751 758 return connection; 752 759 }
Note:
See TracChangeset
for help on using the changeset viewer.