Index: trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 12763)
+++ trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 12765)
@@ -27,5 +27,4 @@
 import org.apache.commons.jcs.engine.control.CompositeCacheManager;
 import org.apache.commons.jcs.utils.serialization.StandardSerializer;
-import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.preferences.BooleanProperty;
@@ -42,6 +41,4 @@
  */
 public final class JCSCacheManager {
-    private static final Logger LOG = FeatureAdapter.getLogger(JCSCacheManager.class.getCanonicalName());
-
     private static volatile CompositeCacheManager cacheManager;
     private static long maxObjectTTL = -1;
@@ -71,10 +68,10 @@
         File cacheDirLockPath = new File(cacheDir, ".lock");
         if (!cacheDirLockPath.exists() && !cacheDirLockPath.createNewFile()) {
-            LOG.log(Level.WARNING, "Cannot create cache dir lock file");
+            Logging.warn("Cannot create cache dir lock file");
         }
         cacheDirLock = new FileOutputStream(cacheDirLockPath).getChannel().tryLock();
 
         if (cacheDirLock == null)
-            LOG.log(Level.WARNING, "Cannot lock cache directory. Will not use disk cache");
+            Logging.warn("Cannot lock cache directory. Will not use disk cache");
 
         // raising logging level gives ~500x performance gain
@@ -230,5 +227,5 @@
         File path = new File(cachePath);
         if (!path.exists() && !path.mkdirs()) {
-            LOG.log(Level.WARNING, "Failed to create cache path: {0}", cachePath);
+            Logging.warn("Failed to create cache path: {0}", cachePath);
         } else {
             ret.setDiskPath(cachePath);
Index: trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java	(revision 12763)
+++ trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java	(revision 12765)
@@ -16,10 +16,7 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import org.apache.commons.jcs.access.behavior.ICacheAccess;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
 import org.openstreetmap.josm.data.cache.ICachedLoaderListener.LoadResult;
 import org.openstreetmap.josm.data.preferences.IntegerProperty;
@@ -46,5 +43,4 @@
  */
 public abstract class JCSCachedTileLoaderJob<K, V extends CacheEntry> implements ICachedLoaderJob<K> {
-    private static final Logger LOG = FeatureAdapter.getLogger(JCSCachedTileLoaderJob.class.getCanonicalName());
     protected static final long DEFAULT_EXPIRE_TIME = TimeUnit.DAYS.toMillis(7);
     // Limit for the max-age value send by the server.
@@ -159,5 +155,5 @@
         }
         if (deduplicationKey == null) {
-            LOG.log(Level.WARNING, "No url returned for: {0}, skipping", getCacheKey());
+            Logging.warn("No url returned for: {0}, skipping", getCacheKey());
             throw new IllegalArgumentException("No url returned");
         }
@@ -174,5 +170,5 @@
         if (first || force) {
             // submit all jobs to separate thread, so calling thread is not blocked with IO when loading from disk
-            LOG.log(Level.FINE, "JCS - Submitting job for execution for url: {0}", getUrlNoException());
+            Logging.debug("JCS - Submitting job for execution for url: {0}", getUrlNoException());
             downloadJobExecutor.execute(this);
         }
@@ -226,5 +222,5 @@
         final String oldName = currentThread.getName();
         currentThread.setName("JCS Downloading: " + getUrlNoException());
-        LOG.log(Level.FINE, "JCS - starting fetch of url: {0} ", getUrlNoException());
+        Logging.debug("JCS - starting fetch of url: {0} ", getUrlNoException());
         ensureCacheElement();
         try {
@@ -232,5 +228,5 @@
             if (!force && cacheElement != null && isCacheElementValid() && isObjectLoadable()) {
                 // we got something in cache, and it's valid, so lets return it
-                LOG.log(Level.FINE, "JCS - Returning object from cache: {0}", getCacheKey());
+                Logging.debug("JCS - Returning object from cache: {0}", getCacheKey());
                 finishLoading(LoadResult.SUCCESS);
                 return;
@@ -245,5 +241,5 @@
                     // try to get stale entry in cache
                     finishLoading(LoadResult.SUCCESS);
-                    LOG.log(Level.FINE, "JCS - found stale object in cache: {0}", getUrlNoException());
+                    Logging.debug("JCS - found stale object in cache: {0}", getUrlNoException());
                 } else {
                     // failed completely
@@ -268,5 +264,5 @@
         }
         if (listeners == null) {
-            LOG.log(Level.WARNING, "Listener not found for URL: {0}. Listener not notified!", getUrlNoException());
+            Logging.warn("Listener not found for URL: {0}. Listener not notified!", getUrlNoException());
             return;
         }
@@ -285,5 +281,5 @@
             expires = Math.min(expires, attributes.getCreateTime() + EXPIRE_TIME_SERVER_LIMIT);
             if (now > expires) {
-                LOG.log(Level.FINE, "JCS - Object {0} has expired -> valid to {1}, now is: {2}",
+                Logging.debug("JCS - Object {0} has expired -> valid to {1}, now is: {2}",
                         new Object[]{getUrlNoException(), Long.toString(expires), Long.toString(now)});
                 return false;
@@ -292,8 +288,8 @@
                 now - attributes.getLastModification() > DEFAULT_EXPIRE_TIME) {
             // check by file modification date
-            LOG.log(Level.FINE, "JCS - Object has expired, maximum file age reached {0}", getUrlNoException());
+            Logging.debug("JCS - Object has expired, maximum file age reached {0}", getUrlNoException());
             return false;
         } else if (now - attributes.getCreateTime() > DEFAULT_EXPIRE_TIME) {
-            LOG.log(Level.FINE, "JCS - Object has expired, maximum time since object creation reached {0}", getUrlNoException());
+            Logging.debug("JCS - Object has expired, maximum time since object creation reached {0}", getUrlNoException());
             return false;
         }
@@ -314,9 +310,9 @@
                     Boolean.TRUE.equals(useHead.get(getServerKey())) &&
                     isCacheValidUsingHead()) {
-                LOG.log(Level.FINE, "JCS - cache entry verified using HEAD request: {0}", getUrl());
+                Logging.debug("JCS - cache entry verified using HEAD request: {0}", getUrl());
                 return true;
             }
 
-            LOG.log(Level.FINE, "JCS - starting HttpClient GET request for URL: {0}", getUrl());
+            Logging.debug("JCS - starting HttpClient GET request for URL: {0}", getUrl());
             final HttpClient request = getRequest("GET", true);
 
@@ -334,5 +330,5 @@
                 // If isModifiedSince or If-None-Match has been set
                 // and the server answers with a HTTP 304 = "Not Modified"
-                LOG.log(Level.FINE, "JCS - If-Modified-Since/ETag test: local version is up to date: {0}", getUrl());
+                Logging.debug("JCS - If-Modified-Since/ETag test: local version is up to date: {0}", getUrl());
                 return true;
             } else if (isObjectLoadable() // we have an object in cache, but we haven't received 304 response code
@@ -344,5 +340,5 @@
                 // for further requests - use HEAD
                 String serverKey = getServerKey();
-                LOG.log(Level.INFO, "JCS - Host: {0} found not to return 304 codes for If-Modified-Since or If-None-Match headers",
+                Logging.info("JCS - Host: {0} found not to return 304 codes for If-Modified-Since or If-None-Match headers",
                         serverKey);
                 useHead.put(serverKey, Boolean.TRUE);
@@ -370,5 +366,5 @@
                     cacheData = createCacheEntry(raw);
                     cache.put(getCacheKey(), cacheData, attributes);
-                    LOG.log(Level.FINE, "JCS - downloaded key: {0}, length: {1}, url: {2}",
+                    Logging.debug("JCS - downloaded key: {0}, length: {1}, url: {2}",
                             new Object[] {getCacheKey(), raw.length, getUrl()});
                     return true;
@@ -376,13 +372,13 @@
                     cacheData = createCacheEntry(new byte[]{});
                     cache.put(getCacheKey(), cacheData, attributes);
-                    LOG.log(Level.FINE, "JCS - Caching empty object {0}", getUrl());
+                    Logging.debug("JCS - Caching empty object {0}", getUrl());
                     return true;
                 } else {
-                    LOG.log(Level.FINE, "JCS - failure during load - reponse is not loadable nor cached as empty");
+                    Logging.debug("JCS - failure during load - reponse is not loadable nor cached as empty");
                     return false;
                 }
             }
         } catch (FileNotFoundException e) {
-            LOG.log(Level.FINE, "JCS - Caching empty object as server returned 404 for: {0}", getUrlNoException());
+            Logging.debug("JCS - Caching empty object as server returned 404 for: {0}", getUrlNoException());
             attributes.setResponseCode(404);
             attributes.setError(e);
@@ -394,5 +390,5 @@
             return doCache;
         } catch (IOException e) {
-            LOG.log(Level.FINE, "JCS - IOExecption during communication with server for: {0}", getUrlNoException());
+            Logging.debug("JCS - IOExecption during communication with server for: {0}", getUrlNoException());
             if (isObjectLoadable()) {
                 return true;
@@ -405,9 +401,8 @@
         } catch (InterruptedException e) {
             attributes.setError(e);
-            LOG.log(Level.WARNING, "JCS - Exception during download {0}", getUrlNoException());
-            Logging.warn(e);
+            Logging.logWithStackTrace(Logging.LEVEL_WARN, e, "JCS - Exception during download {0}", getUrlNoException());
             Thread.currentThread().interrupt();
         }
-        LOG.log(Level.WARNING, "JCS - Silent failure during download: {0}", getUrlNoException());
+        Logging.warn("JCS - Silent failure during download: {0}", getUrlNoException());
         return false;
     }
Index: trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 12763)
+++ trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 12765)
@@ -17,9 +17,6 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import org.apache.commons.jcs.access.behavior.ICacheAccess;
-import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
 import org.openstreetmap.gui.jmapviewer.Tile;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob;
@@ -43,5 +40,4 @@
  */
 public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener {
-    private static final Logger LOG = FeatureAdapter.getLogger(TMSCachedTileLoaderJob.class.getCanonicalName());
     private static final LongProperty MAXIMUM_EXPIRES = new LongProperty("imagery.generic.maximum_expires", TimeUnit.DAYS.toMillis(30));
     private static final LongProperty MINIMUM_EXPIRES = new LongProperty("imagery.generic.minimum_expires", TimeUnit.HOURS.toMillis(1));
@@ -123,6 +119,7 @@
                 return content.length > 0 || cacheData.getImage() != null || isNoTileAtZoom();
             } catch (IOException e) {
-                LOG.log(Level.WARNING, "JCS TMS - error loading from cache for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()});
-                Logging.warn(e);
+                Logging.logWithStackTrace(Logging.LEVEL_WARN, e, "JCS TMS - error loading from cache for tile {0}: {1}",
+                        new Object[] {tile.getKey(), e.getMessage()}
+                        );
             }
         }
@@ -208,5 +205,5 @@
             }
         } catch (IOException e) {
-            LOG.log(Level.WARNING, "JCS TMS - error loading object for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()});
+            Logging.warn("JCS TMS - error loading object for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()});
             tile.setError(e);
             tile.setLoaded(false);
@@ -259,5 +256,5 @@
     private boolean handleNoTileAtZoom() {
         if (isNoTileAtZoom()) {
-            LOG.log(Level.FINE, "JCS TMS - Tile valid, but no file, as no tiles at this level {0}", tile);
+            Logging.debug("JCS TMS - Tile valid, but no file, as no tiles at this level {0}", tile);
             tile.setError("No tile at this zoom level");
             tile.putValue("tile-info", "no-tile");
@@ -269,5 +266,5 @@
     private boolean isNoTileAtZoom() {
         if (attributes == null) {
-            LOG.warning("Cache attributes are null");
+            Logging.warn("Cache attributes are null");
         }
         return attributes != null && attributes.isNoTileAtZoom();
Index: trunk/src/org/openstreetmap/josm/tools/Logging.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Logging.java	(revision 12763)
+++ trunk/src/org/openstreetmap/josm/tools/Logging.java	(revision 12765)
@@ -271,4 +271,17 @@
     }
 
+    /**
+     * Logs a throwable that happened. Adds the stack trace to the log.
+     * @param level The level.
+     * @param t The throwable that should be logged.
+     * @param pattern The formatted message to print.
+     * @param args The objects to insert into format string
+     * @see #logWithStackTrace(Level, Throwable)
+     */
+    public static void logWithStackTrace(Level level, Throwable t, String pattern, Object... args) {
+        logPrivate(level, () -> getErrorLogWithStack(MessageFormat.format(pattern,  args), t));
+    }
+
+
     private static void logPrivate(Level level, String pattern, Object... args) {
         logPrivate(level, () -> MessageFormat.format(pattern, args));
