本文整理了Java中org.webpieces.util.logging.Logger
类的一些代码示例,展示了Logger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger
类的具体详情如下:
包路径:org.webpieces.util.logging.Logger
类名称:Logger
暂无
代码示例来源:origin: org.webpieces/core-util
private static void logSuppressed(Throwable[] suppressed) {
for(Throwable s: suppressed) {
log.info("SUPPRESSED exception(meaning it's secondary after a main failure", s);
}
}
代码示例来源:origin: org.webpieces/http-frontend2
private Void logException(Throwable t) {
log.error("exception", t);
return null;
}
代码示例来源:origin: org.webpieces/http-router
public void printRoutes(boolean isHttps, String tabSpaces) {
//This is a pain but dynamically build up the html
String routeHtml = build(tabSpaces);
//print in warn so it's in red for anyone and to stderr IF they have debug enabled
//it's kind of weird BUT great for tests
if(!isHttps)
log.warn("WARNING: The request is NOT https so perhaps your route is only accessible over https so modify your request" + routeHtml);
else
log.warn(routeHtml);
}
代码示例来源:origin: org.webpieces/runtimecompile
/**
* Compile the class from Java source
*
* @return the bytes that comprise the class file
*/
public byte[] compile(CompilerWrapper compiler, ClassDefinitionLoader loader) {
long start = System.currentTimeMillis();
compiler.compile(new String[] { this.name }, loader);
if(log.isTraceEnabled()) {
long time = System.currentTimeMillis()-start;
log.trace(()->time+"ms to compile class "+name);
}
return this.javaByteCode;
}
代码示例来源:origin: org.webpieces/core-channelmanager2
public boolean runDelayedAction() {
log.trace(()->channel+"Closing channel.");
try {
channel.closeImpl();
//must wake up selector or socket will not send the TCP FIN packet!!!!!
//The above only happens on the client thread...on selector thread, close works fine.
channel.wakeupSelector();
handler.complete(null);
} catch(Exception e) {
log.error(channel+"Exception occurred", e);
handler.completeExceptionally(e);
}
return true;
}
代码示例来源:origin: org.webpieces/http-frontend
@Override
public void incomingData(Channel channel, ByteBuffer b){
try {
InetSocketAddress addr = channel.getRemoteAddress();
channel.setName(""+addr);
log.trace(()->"incoming data. size="+b.remaining()+" channel="+channel);
processor.deserialize(channel, b);
} catch(ParseException e) {
HttpClientException exc = new HttpClientException("Could not parse http request", KnownStatusCode.HTTP_400_BADREQUEST, e);
//move down to debug level later on..
log.info("Client screwed up", exc);
SupressedExceptionLog.log(exc); //next log secondary exceptions
sendBadResponse(channel, exc);
} catch(Throwable e) {
HttpServerException exc = new HttpServerException("There was a bug in the server, please see the server logs", KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR, e);
log.error("Exception processing", exc);
SupressedExceptionLog.log(exc);
sendBadResponse(channel, exc);
}
}
代码示例来源:origin: org.webpieces/http-common
private void preconditions() {
// If we haven't gotten the settings, let's wait a little bit because another thread
// might have the settings frame and hasn't gotten around to processing it yet.
try {
Http2EngineImpl.log.info("Waiting for settings frame to arrive");
if (!this.http2EngineImpl.settingsLatch.await(500, TimeUnit.MILLISECONDS))
throw new GoAwayError(this.http2EngineImpl.lastClosedRemoteOriginatedStream().orElse(0), Http2ErrorCode.PROTOCOL_ERROR, Http2EngineImpl.wrapperGen.emptyWrapper());
} catch (InterruptedException e) {
Http2EngineImpl.log.error("Caught exception while waiting for settings frame", e);
throw new GoAwayError(this.http2EngineImpl.lastClosedRemoteOriginatedStream().orElse(0), Http2ErrorCode.PROTOCOL_ERROR, Http2EngineImpl.wrapperGen.emptyWrapper());
}
}
代码示例来源:origin: org.webpieces/http-templating
protected void put(HtmlTag tag) {
HtmlTag htmlTag = tags.get(tag.getName());
if(htmlTag != null)
log.warn("You are overriding Tag="+tag.getName()+" from class="+htmlTag.getClass()+" to your class="+tag.getClass());
else
log.info("adding tag="+tag.getName());
tags.put(tag.getName(), tag);
}
代码示例来源:origin: org.webpieces/core-ssl
private void logAndCheck(ByteBuffer encryptedData, SSLEngineResult result, ByteBuffer outBuffer, Status status, HandshakeStatus hsStatus, int i) {
final ByteBuffer data = encryptedData;
log.trace(()->mem+"[sockToEngine] unwrap done pos="+data.position()+" lim="+
data.limit()+" status="+status+" hs="+hsStatus);
if(i > 1000) {
throw new RuntimeException(this+"Bug, stuck in loop, encryptedData="+encryptedData+" outBuffer="+outBuffer+
" hsStatus="+hsStatus+" status="+status);
} else if(status == Status.BUFFER_UNDERFLOW) {
final ByteBuffer data1 = encryptedData;
log.trace(()->"buffer underflow. data="+data1.remaining());
}
}
代码示例来源:origin: org.webpieces/core-channelmanager2
log.warn(channel+"Overloaded channel. unregistering until YOU catch up you slowass(lol). num="+unackedByteCnt+" max="+channel.getMaxUnacked());
unregisterSelectableChannel(channel, SelectionKey.OP_READ);
log.warn(channel+"BOOM. you caught back up, reregistering for reads now. unackedCnt="+unackedCnt+" readThreshold="+channel.getReadThreshold());
channel.registerForReads();
apiLog.error(channel+" Exception on incoming data", t);
return null;
});
代码示例来源:origin: org.webpieces/core-statemachine
/**
* @param smState
* @param evt
*/
public void fireEvent(StateMachineState smState, Object evt)
{
TransitionImpl transition = evtToTransition.get(evt);
if(transition == null) {
log.debug(() -> smState+"No Transition: "+getName()+" -> <no transition found>, event="+evt);
if(noTransitionListener != null)
noTransitionListener.noTransitionFromEvent(smState.getCurrentState(), evt);
return;
}
State nextState = transition.getEndState();
if(log.isDebugEnabled())
log.debug(() -> smState+"Transition: "+getName()+" -> "+nextState+", event="+evt);
try {
smState.setCurrentState(nextState);
} catch(RuntimeException e) {
log.warn(smState+"Transition FAILED: "+getName()+" -> "+nextState+", event="+evt);
throw e;
}
}
代码示例来源:origin: org.webpieces/runtimecompile
log.trace(()->"Loading class for "+name);
resolveClass(applicationClass.javaClass);
if(log.isDebugEnabled()) {
long time = System.currentTimeMillis() - start;
log.trace(()->time+"ms to load class "+name+" from cache");
resolveClass(applicationClass.javaClass);
if(log.isTraceEnabled()) {
long time = System.currentTimeMillis() - start;
log.trace(()->time+"ms to load class "+name);
代码示例来源:origin: org.webpieces/core-util
/**
* Log a message at the DEBUG level.
*
* Usage: log.debug(()->"my lazy log statement")
*
* @param msg the message string to be logged
*/
public void debug(Supplier<String> msg) {
if(isDebugEnabled())
logger.debug(msg.get());
}
代码示例来源:origin: org.webpieces/core-util
public CompletableFuture<RESP> get() {
log.debug(() -> "key:"+key+" start virtual single thread. ");
CompletableFuture<RESP> fut = processor.get();
log.debug(() -> "key:"+key+" halfway there. future needs to be acked to finish work and release virtual thread");
return fut;
}
};
代码示例来源:origin: org.webpieces/core-util
public <RESP> CompletableFuture<RESP> lock(Function<Lock, CompletableFuture<RESP>> processor) {
int id = counter.getAndIncrement();
String key = logId+id;
if(permitQueue.backupSize() > queuedBackupWarnThreshold)
log.warn("id:"+key+" Your lock is backing up with requests. either too much contention or deadlock occurred(either way, you should fix this)");
Lock lock = new LockImpl(key);
Supplier<CompletableFuture<RESP>> proxy = new Supplier<CompletableFuture<RESP>>() {
public CompletableFuture<RESP> get() {
log.info("key:"+key+" enter async sync block");
CompletableFuture<RESP> fut = processor.apply(lock);
return fut;
}
};
log.info("key:"+key+" aboud to get lock or get queued");
return permitQueue.runRequest(proxy);
}
代码示例来源:origin: org.webpieces/core-channelmanager2
@Override
public void run() {
try {
running = true;
runLoop();
log.trace(()->"shutting down the PollingThread");
selector.close();
selector = null;
thread = null;
synchronized(JdkSelectorImpl.this) {
running = false;
JdkSelectorImpl.this.notifyAll();
}
} catch (Exception e) {
log.error("Exception on ConnectionManager thread", e);
}
}
}
代码示例来源:origin: org.webpieces/core-ssl
private void logTrace(ByteBuffer encryptedData, Status status, HandshakeStatus hsStatus) {
log.trace(()->mem+"[sockToEngine] reset pos="+encryptedData.position()+" lim="+encryptedData.limit()+" status="+status+" hs="+hsStatus);
}
代码示例来源:origin: org.webpieces/core-util
/**
* Log an exception (throwable) at the DEBUG level with an
* accompanying message.
*
* @param msg the message accompanying the exception
* @param t the exception (throwable) to log
*/
public void debug(Supplier<String> msg, Throwable t) {
if(isDebugEnabled())
logger.debug(msg.get(), t);
}
代码示例来源:origin: org.webpieces/core-util
private <RESP> CompletableFuture<RESP> release(RESP v, Throwable e) {
log.debug(() -> "key:"+key+" end virtual single thread");
//immediately release when future is complete
queue.releasePermit();
CompletableFuture<RESP> future = new CompletableFuture<RESP>();
if (e != null) {
future.completeExceptionally(e);
} else
future.complete(v);
return future;
}
代码示例来源:origin: org.webpieces/http1_1-client
@Override
public void farEndClosed(Channel channel) {
log.info("far end closed");
isClosed = true;
}
内容来源于网络,如有侵权,请联系作者删除!