本文整理了Java中water.util.Log.err()
方法的一些代码示例,展示了Log.err()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.err()
方法的具体详情如下:
包路径:water.util.Log
类名称:Log
方法名:err
[英]Record a message to the log file and store.
[中]将消息记录到日志文件并存储。
代码示例来源:origin: h2oai/h2o-2
/** Record an exception to the log file and store. */
static public <T extends Throwable> T err(Sys t, T exception) {
return err(t, "", exception);
}
/** Record an exception to the log file and store. */
代码示例来源:origin: h2oai/h2o-2
static public Iced newInstance(int id) {
if( id >= CLAZZES.length || CLAZZES[id] == null ) loadId(id);
Iced f = (Iced) GOLD[id];
if( f == null ) {
try { GOLD[id] = f = (Iced) Class.forName(CLAZZES[id]).newInstance(); }
catch( Exception e ) { Log.err("Failed newinstance for class "+className(id)); throw Log.errRTExcept(e); }
}
return f.newInstance();
}
代码示例来源:origin: h2oai/h2o-2
/** Record an exception to the log file and store. */
static public <T extends Throwable> T err(String msg, T exception) {
return err(Sys.WATER, msg, exception);
}
/** Record a message to the log file and store. */
代码示例来源:origin: h2oai/h2o-2
/** Record a message to the log file and store. */
static public void err(String msg) {
err(Sys.WATER, msg);
}
/** Record an exception to the log file and store. */
代码示例来源:origin: h2oai/h2o-2
/** Record an exception to the log file and store. */
static public <T extends Throwable> T err(T exception) {
return err(Sys.WATER, "", exception);
}
/** Record an exception to the log file and store and return a new
代码示例来源:origin: h2oai/h2o-2
/** Record an exception to the log file and store and return a new
* RuntimeException that wraps around the exception. */
static public RuntimeException errRTExcept(Throwable exception) {
return new RuntimeException(err(Sys.WATER, "", exception));
}
/** Log a warning to standard out, the log file and the store. */
代码示例来源:origin: h2oai/h2o-2
/** Exceptional completion path; mostly does printing if the exception was
* not handled earlier in the stack. */
@Override public boolean onExceptionalCompletion(Throwable ex, jsr166y.CountedCompleter caller) {
System.err.println("onExCompletion for "+this);
ex.printStackTrace();
water.util.Log.err(ex);
return true;
}
// Run at max priority until we decrypt the packet enough to get priorities out
代码示例来源:origin: h2oai/h2o-2
public static double getBoolean( Comparable o ) {
if( o instanceof Boolean ) return ((Boolean)o) ? 1.0 : 0.0;
if( o instanceof String ) {
try {
if( "true" .equalsIgnoreCase((String) o) ) return 1.0;
if( "false".equalsIgnoreCase((String) o) ) return 0.0;
} catch( Throwable t ) { Log.err(t); }
}
return Double.NaN;
}
public static String getString( HashMap<String,Comparable> row, String s ) {
代码示例来源:origin: h2oai/h2o-2
/**
* Convenience method that makes an InputStream out of
* given text.
*/
public Response( String status, String mimeType, String txt )
{
this.status = status;
this.mimeType = mimeType;
try
{
this.data = new ByteArrayInputStream( txt.getBytes("UTF-8"));
}
catch ( java.io.UnsupportedEncodingException e ) { Log.err(e); }
}
代码示例来源:origin: h2oai/h2o-2
public int get() {
if( _idx > 0 ) return _buf[--_idx];
try {
int b = _is.read();
if( b != -1 ) return b;
} catch( IOException ioe ) { Log.err(ioe); }
throw new ParseException("Premature EOF");
}
public int peek() {
代码示例来源:origin: h2oai/h2o-2
public static void setTimezone(String tz) {
Set<String> idSet = DateTimeZone.getAvailableIDs();
if(idSet.contains(tz))
_timezone = DateTimeZone.forID(tz);
else
Log.err("Attempted to set unrecognized timezone: "+ tz);
}
代码示例来源:origin: h2oai/h2o-2
/** Returns new error response with given error message.
*/
public static Response error(Throwable e) {
if( !(e instanceof IllegalAccessException ))
Log.err(e);
String message = e.getMessage();
if( message == null ) message = e.getClass().toString();
return error(message);
}
public static Response error(String message) {
代码示例来源:origin: h2oai/h2o-2
public static final H2ONode intern( int ip, int port ) {
byte[] b = new byte[4];
b[0] = (byte)(ip>> 0);
b[1] = (byte)(ip>> 8);
b[2] = (byte)(ip>>16);
b[3] = (byte)(ip>>24);
try {
return intern(InetAddress.getByAddress(b),port);
} catch( UnknownHostException e ) {
Log.err(e);
return null;
}
}
代码示例来源:origin: h2oai/h2o-2
@Override public void run() {
while( true ) {
try {
// Try to get the NanoHTTP daemon started
SERVER = new RequestServer(H2O._apiSocket);
break;
} catch( Exception ioe ) {
Log.err(Sys.HTTPD,"Launching NanoHTTP server got ",ioe);
try { Thread.sleep(1000); } catch( InterruptedException e ) { } // prevent denial-of-service
}
}
}
}, "Request Server launcher").start();
代码示例来源:origin: h2oai/h2o-2
public int peek() {
if( _idx > 0 ) return _buf[_idx-1];
try {
int b = _is.read();
if( b != -1 ) return push(b);
} catch( IOException e ) { Log.err(e); }
throw new ParseException("Premature EOF");
}
int push( int b ) { return (_buf[_idx++] = b); }
代码示例来源:origin: h2oai/h2o-2
@Override public void run() {
try {
SSH.this.start();
SSH.this.waitFor();
} catch( Exception ex ) {
Log.err(ex);
}
}
};
代码示例来源:origin: h2oai/h2o-2
boolean check_refcnt( Vec vec ) {
IcedInt I = _refcnt.get(vec);
int cnt0 = I==null ? 0 : I._val;
int cnt1 = compute_refcnt(vec);
if( cnt0==cnt1 ) return true;
Log.err("Refcnt is "+cnt0+" but computed as "+cnt1);
return false;
}
代码示例来源:origin: h2oai/h2o-2
@Override public float[] scoreKey( Object modelKey, String [] colNames, String domains[][], double[] row ) {
Key key = (Key)modelKey;
String sk = key.toString();
Value v = DKV.get(key);
if (v == null)
throw new IllegalArgumentException("Key "+sk+" not found!");
try {
return scoreModel(v.get(),colNames,domains,row);
} catch(Throwable t) {
Log.err(t);
throw new IllegalArgumentException("Key "+sk+" is not a Model key");
}
}
代码示例来源:origin: h2oai/h2o-2
@Override public void compute2() {
Value v = DKV.get(k);
if( v==null ) Log.err("Missing vector #" + ii + " (" + _names[ii] + ") during Frame fetch: "+k);
vecs[ii] = v.get();
tryComplete();
}
};
代码示例来源:origin: h2oai/h2o-3
private <M extends Model<?, ?, ?>> M saveAndLoad(M model, boolean deleteModel) throws IOException {
File file = File.createTempFile(model.getClass().getSimpleName(),null);
try {
String path = file.getAbsolutePath();
model.exportBinaryModel(path, true);
if( deleteModel ) model.delete();
return Model.importBinaryModel(path);
} finally {
if (! file.delete())
Log.err("Temporary file " + file + " was not deleted.");
}
}
内容来源于网络,如有侵权,请联系作者删除!