Index: applications/editors/josm/plugins/imagerycache/build.xml
===================================================================
--- applications/editors/josm/plugins/imagerycache/build.xml	(revision 29367)
+++ applications/editors/josm/plugins/imagerycache/build.xml	(revision 29368)
@@ -15,5 +15,5 @@
 
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="JOSM/ImageryCache: Initial commit"/>
+    <property name="commit.message" value="JOSM/ImageryCache: corrected cache file name, added imagerycache.debug option"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="5779"/>
Index: applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/OsmDBTilesLoader.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/OsmDBTilesLoader.java	(revision 29367)
+++ applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/OsmDBTilesLoader.java	(revision 29368)
@@ -13,9 +13,6 @@
 import java.util.Map;
 import java.util.Random;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import org.mapdb.DB;
 import org.mapdb.DBMaker;
-import org.mapdb.Serializer;
 import org.openstreetmap.gui.jmapviewer.JobDispatcher;
 import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
@@ -25,4 +22,5 @@
 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource.TileUpdate;
+import org.openstreetmap.josm.data.preferences.BooleanProperty;
 
 /**
@@ -33,10 +31,9 @@
     
     
-    private static final Logger log = Logger.getLogger(OsmDBTilesLoader.class.getName());
     public static final long FILE_AGE_ONE_DAY = 1000 * 60 * 60 * 24;
     public static final long FILE_AGE_ONE_WEEK = FILE_AGE_ONE_DAY * 7;
-
-    
-    
+    
+    public static final boolean debug = new BooleanProperty("imagerycache.debug", false).get();
+
     static class TileDAOMapDB {
         protected HashMap<String, DB> dbs = new HashMap<String, DB>();
@@ -53,5 +50,5 @@
                 try {
                 db = DBMaker
-                    .newFileDB(new File(cacheFolder, source.replaceAll("[\\\\/:*?\"<>| ]", "_")))
+                    .newFileDB(new File(cacheFolder, "tiles_"+source.replaceAll("[\\\\/:*?\"<>| ]", "_")))
                     .randomAccessFileEnableIfNeeded()
                     .journalDisable()
@@ -60,6 +57,6 @@
                 dbs.put(source, db);
                 } catch (Exception e) {
-                    log.warning("Error: Can not create MapDB file");
-                    e.printStackTrace();
+                    System.out.println("Error: Can not create MapDB file");
+                    e.printStackTrace(System.out);
                 }
             }
@@ -74,8 +71,8 @@
                     m = d.getHashMap("tiles");
                     storages.put(source, m);
-                    log.log(Level.FINEST, "Created storage {0}", source);
+                    if (debug) System.out.println("Created storage "+source);
                 } catch (Exception e) {
-                    log.severe("Error: Can not create HashMap in MapDB storage");
-                    e.printStackTrace();
+                    System.out.println("Error: Can not create HashMap in MapDB storage");
+                    e.printStackTrace(System.out);
                 }
             }
@@ -93,10 +90,10 @@
 
         protected void updateModTime(String source, long id, DBTile dbTile) {
-            log.finest("Updating modification time");
+            if (debug) System.out.println("Tile "+id+": Updating modification time");
             getStorage(source).put(id, dbTile);
         }
 
         protected void updateTile(String source, long id, DBTile dbTile) {
-            log.finest("Updating tile in base");
+            if (debug) System.out.println("Tile "+id+": Updating tile in base");
             getStorage(source).put(id, dbTile);
         }
@@ -240,5 +237,5 @@
                     case LastModified:      // (2)
                         if (!isOsmTileNewer(fileAge)) {
-                            log.finest("LastModified test: local version is up to date: " + tile);
+                            System.out.println("Tile "+id+": LastModified test: local version is up to date");
                             dbTile.lastModified = getLastModTime();
                             dao.updateModTime(sourceName, id, dbTile);
@@ -271,5 +268,5 @@
                     // If we are isModifiedSince or If-None-Match has been set
                     // and the server answers with a HTTP 304 = "Not Modified"
-                    log.finest("Answer from HTTP: 304 / ETag test: local version is up to date: " + tile);
+                    if (debug) System.out.println("Tile "+id+": Answer from HTTP=304 / ETag test: local version is up to date");
                     dbTile.lastModified = getLastModTime();
                     dao.updateModTime(sourceName, id, dbTile);
@@ -290,5 +287,5 @@
                             continue;
                         }
-                        log.log(Level.FINE, "Loading from OSM{0}", tile);
+                        if (debug) System.out.println("Tile "+id+": Loading from OSM, "+ tile);
                         byte[] buffer = loadTileInBuffer(urlConn);
                         if (buffer != null) {
@@ -308,6 +305,6 @@
                 listener.tileLoadingFinished(tile, false);
                 try {
-                    log.log(Level.SEVERE, "Failed loading {0}: {1}", new Object[]{tile.getUrl(), e.getMessage()});
-                    e.printStackTrace();
+                    System.out.println("Tile "+id+": Error: Failed loading from "+tile.getUrl());
+                    e.printStackTrace(System.out);
                 } catch(IOException i) {
                 }
