Fix logging

This commit is contained in:
vshcherb 2011-12-30 12:23:45 +01:00
parent 1716d8bebe
commit 88ea34e8c0

View file

@ -50,6 +50,7 @@ import net.osmand.swing.OsmExtractionUI;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.Jdk14Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@ -542,13 +543,12 @@ public class IndexBatchCreator {
try { try {
fh = new FileHandler(new File(workDir, mapFileName+".gen.log").getAbsolutePath(), 5000000, 1, true); fh = new FileHandler(new File(workDir, mapFileName+".gen.log").getAbsolutePath(), 5000000, 1, true);
fh.setFormatter(new SimpleFormatter()); fh.setFormatter(new SimpleFormatter());
Logger logger = LogManager.getLogManager().getLogger("batch.file.generation.log"); fh.setLevel(Level.ALL);
Handler[] hs = logger.getHandlers(); Jdk14Logger jdk14Logger = new Jdk14Logger("tempLogger");
for(int ik=0; ik<hs.length; ik++) { jdk14Logger.getLogger().setLevel(Level.ALL);
logger.removeHandler(hs[ik]); jdk14Logger.getLogger().setUseParentHandlers(false);
} jdk14Logger.getLogger().addHandler(fh);
logger.addHandler(fh); warningsAboutMapData = jdk14Logger;
warningsAboutMapData = LogFactory.getLog("net.osmand.batch.generation.log");
} catch (SecurityException e1) { } catch (SecurityException e1) {
e1.printStackTrace(); e1.printStackTrace();
} catch (IOException e1) { } catch (IOException e1) {