Logger.getGlobal().setLevel(Level.OFF); getBaseLogger().setLevel(Level.ALL); StringBuilder logfile = new StringBuilder();
/** * Returns an exception trace. All tabs will have been replaced by 4 white spaces. This method * was used to be a private one in {@link org.geotools.gui.swing.ExceptionMonitor}. Do not rely * on it. */ public static String printStackTrace(final Throwable exception) { final StringWriter writer = new StringWriter(); java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", exception); return writer.toString(); } }
/** Cleans this {@link GrassBinaryImageWriter}. */ public void dispose() { try { rasterWriter.close(); } catch (Exception e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); } super.dispose(); }
public static final Logger applog = Logger.getGlobal(); ... // Create and set handler Handler systemOut = new ConsoleHandler(); systemOut.setLevel( Level.ALL ); applog.addHandler( systemOut ); applog.setLevel( Level.ALL ); // Prevent logs from processed by default Console handler. applog.setUseParentHandlers( false ); // Solution 1 Logger.getLogger("").setLevel( Level.OFF ); // Solution 2
public static void main(String[] args) { Toolbox toolBox = new Toolbox(); boolean retval = false; try { retval = toolBox.parse(args); } catch (IOException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); retval = false; } if (retval) System.exit(0); else System.exit(1); }
public void errorOccurred(Exception e) { java.util.logging.Logger.getGlobal() .log(java.util.logging.Level.INFO, "", e); errors++; } });
public void errorOccurred(Exception e) { java.util.logging.Logger.getGlobal() .log(java.util.logging.Level.INFO, "", e); fail( "Got an exception during rendering, this should not happen, " + "not even with emtpy geometries"); } });
@Override protected boolean isOnline() throws Exception { try { CRS.decode("EPSG:4326"); return true; } catch (Exception e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); return false; } } }
public void errorOccurred(Exception e) { java.util.logging.Logger.getGlobal() .log(java.util.logging.Level.INFO, "", e); fail("Failed to render coverage"); } };
public void testConstructorOk() { try { Shape shape = createMock(Shape.class); ExplicitBoundsShape target = new ExplicitBoundsShape(shape); assertNotNull(target); } catch (Throwable e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Should not throw " + e.getClass().getSimpleName()); } }
@Test public void testConstructorOK() { try { new UomRescaleStyleVisitor(1); } catch (Exception e2) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e2); fail(e2.getClass().getSimpleName() + " should not be thrown."); } }
public void testEquals_Object() { try { Shape shape = createMock(Shape.class); ExplicitBoundsShape target = new ExplicitBoundsShape(shape); assertFalse(target.equals(new Object())); } catch (Throwable e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Should not throw " + e.getClass().getSimpleName()); } }
@Test public void validAccountOwnerMatches1() { Logger.getGlobal().info("Start validAccount test"); List<Account> accounts = accountController.byOwner("Keri"); Logger.getGlobal().info("In validAccount test"); Assert.assertNotNull(accounts); Assert.assertEquals(1, accounts.size()); Account account = accounts.get(0); Assert.assertEquals(ACCOUNT_1, account.getNumber()); Assert.assertEquals(ACCOUNT_1_NAME, account.getOwner()); Logger.getGlobal().info("End validAccount test"); }
@Test public void validAccountOwner() { Logger.getGlobal().info("Start validAccount test"); List<Account> accounts = accountController.byOwner(ACCOUNT_1_NAME); Logger.getGlobal().info("In validAccount test"); Assert.assertNotNull(accounts); Assert.assertEquals(1, accounts.size()); Account account = accounts.get(0); Assert.assertEquals(ACCOUNT_1, account.getNumber()); Assert.assertEquals(ACCOUNT_1_NAME, account.getOwner()); Logger.getGlobal().info("End validAccount test"); }
public void testEquals_Null() { try { Shape shape = createMock(Shape.class); ExplicitBoundsShape target = new ExplicitBoundsShape(shape); assertFalse(target.equals(null)); } catch (Throwable e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Should not throw " + e.getClass().getSimpleName()); } }
public void testEquals_SameObject() { try { Shape shape = createMock(Shape.class); ExplicitBoundsShape target = new ExplicitBoundsShape(shape); assertTrue(target.equals(target)); } catch (Throwable e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Should not throw " + e.getClass().getSimpleName()); } }
@Override protected SimpleFeatureType buildFeatureType() throws IOException { String typeName = getEntry().getTypeName(); String namespace = getEntry().getName().getNamespaceURI(); String typeSpec = property("_"); try { return DataUtilities.createType(namespace, typeName, typeSpec); } catch (SchemaException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); throw new DataSourceException(typeName + " schema not available", e); } }
@Test public void validAccountNumber() { Logger.getGlobal().info("Start validAccountNumber test"); Account account = accountController.byNumber(ACCOUNT_1); Assert.assertNotNull(account); Assert.assertEquals(ACCOUNT_1, account.getNumber()); Assert.assertEquals(ACCOUNT_1_NAME, account.getOwner()); Logger.getGlobal().info("End validAccount test"); }
public void testGetFeaturesWithInvalidFilter() throws Exception { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); PropertyIsEqualTo f = ff.equals(ff.property("invalidAttribute"), ff.literal(5)); // make sure a complaint related to the invalid filter is thrown here try (SimpleFeatureIterator fi = featureSource.getFeatures(f).features()) { fail("This query should have failed, it contains an invalid filter"); } catch (Exception e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); // fine } }
public void testGetFeatureTypes() { try { String[] names = dataStore.getTypeNames(); assertTrue(contains(names, tname("road"))); assertTrue(contains(names, tname("river"))); } catch (IOException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("An IOException has been thrown!"); } }