本文整理了Java中java.util.logging.Logger.getGlobal()
方法的一些代码示例,展示了Logger.getGlobal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getGlobal()
方法的具体详情如下:
包路径:java.util.logging.Logger
类名称:Logger
方法名:getGlobal
[英]Return global logger object with the name Logger.GLOBAL_LOGGER_NAME.
[中]返回名为logger的全局记录器对象。全局记录器名称。
代码示例来源:origin: oracle/opengrok
Logger.getGlobal().setLevel(Level.OFF);
getBaseLogger().setLevel(Level.ALL);
StringBuilder logfile = new StringBuilder();
代码示例来源:origin: geotools/geotools
/**
* 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();
}
}
代码示例来源:origin: geotools/geotools
/** 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();
}
代码示例来源:origin: stackoverflow.com
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
代码示例来源:origin: geotools/geotools
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);
}
代码示例来源:origin: geotools/geotools
public void errorOccurred(Exception e) {
java.util.logging.Logger.getGlobal()
.log(java.util.logging.Level.INFO, "", e);
errors++;
}
});
代码示例来源:origin: geotools/geotools
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");
}
});
代码示例来源:origin: geotools/geotools
@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;
}
}
}
代码示例来源:origin: geotools/geotools
public void errorOccurred(Exception e) {
java.util.logging.Logger.getGlobal()
.log(java.util.logging.Level.INFO, "", e);
fail("Failed to render coverage");
}
};
代码示例来源:origin: geotools/geotools
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());
}
}
代码示例来源:origin: geotools/geotools
@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.");
}
}
代码示例来源:origin: geotools/geotools
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());
}
}
代码示例来源:origin: paulc4/microservices-demo
@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");
}
代码示例来源:origin: paulc4/microservices-demo
@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");
}
代码示例来源:origin: geotools/geotools
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());
}
}
代码示例来源:origin: geotools/geotools
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());
}
}
代码示例来源:origin: geotools/geotools
@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);
}
}
代码示例来源:origin: paulc4/microservices-demo
@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");
}
代码示例来源:origin: geotools/geotools
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
}
}
代码示例来源:origin: geotools/geotools
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!");
}
}
内容来源于网络,如有侵权,请联系作者删除!