org.webpieces.util.logging.Logger类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(263)

本文整理了Java中org.webpieces.util.logging.Logger类的一些代码示例,展示了Logger类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger类的具体详情如下:
包路径:org.webpieces.util.logging.Logger
类名称:Logger

Logger介绍

暂无

代码示例

代码示例来源:origin: org.webpieces/core-util

  1. private static void logSuppressed(Throwable[] suppressed) {
  2. for(Throwable s: suppressed) {
  3. log.info("SUPPRESSED exception(meaning it's secondary after a main failure", s);
  4. }
  5. }

代码示例来源:origin: org.webpieces/http-frontend2

  1. private Void logException(Throwable t) {
  2. log.error("exception", t);
  3. return null;
  4. }

代码示例来源:origin: org.webpieces/http-router

  1. public void printRoutes(boolean isHttps, String tabSpaces) {
  2. //This is a pain but dynamically build up the html
  3. String routeHtml = build(tabSpaces);
  4. //print in warn so it's in red for anyone and to stderr IF they have debug enabled
  5. //it's kind of weird BUT great for tests
  6. if(!isHttps)
  7. log.warn("WARNING: The request is NOT https so perhaps your route is only accessible over https so modify your request" + routeHtml);
  8. else
  9. log.warn(routeHtml);
  10. }

代码示例来源:origin: org.webpieces/runtimecompile

  1. /**
  2. * Compile the class from Java source
  3. *
  4. * @return the bytes that comprise the class file
  5. */
  6. public byte[] compile(CompilerWrapper compiler, ClassDefinitionLoader loader) {
  7. long start = System.currentTimeMillis();
  8. compiler.compile(new String[] { this.name }, loader);
  9. if(log.isTraceEnabled()) {
  10. long time = System.currentTimeMillis()-start;
  11. log.trace(()->time+"ms to compile class "+name);
  12. }
  13. return this.javaByteCode;
  14. }

代码示例来源:origin: org.webpieces/core-channelmanager2

  1. public boolean runDelayedAction() {
  2. log.trace(()->channel+"Closing channel.");
  3. try {
  4. channel.closeImpl();
  5. //must wake up selector or socket will not send the TCP FIN packet!!!!!
  6. //The above only happens on the client thread...on selector thread, close works fine.
  7. channel.wakeupSelector();
  8. handler.complete(null);
  9. } catch(Exception e) {
  10. log.error(channel+"Exception occurred", e);
  11. handler.completeExceptionally(e);
  12. }
  13. return true;
  14. }

代码示例来源:origin: org.webpieces/http-frontend

  1. @Override
  2. public void incomingData(Channel channel, ByteBuffer b){
  3. try {
  4. InetSocketAddress addr = channel.getRemoteAddress();
  5. channel.setName(""+addr);
  6. log.trace(()->"incoming data. size="+b.remaining()+" channel="+channel);
  7. processor.deserialize(channel, b);
  8. } catch(ParseException e) {
  9. HttpClientException exc = new HttpClientException("Could not parse http request", KnownStatusCode.HTTP_400_BADREQUEST, e);
  10. //move down to debug level later on..
  11. log.info("Client screwed up", exc);
  12. SupressedExceptionLog.log(exc); //next log secondary exceptions
  13. sendBadResponse(channel, exc);
  14. } catch(Throwable e) {
  15. HttpServerException exc = new HttpServerException("There was a bug in the server, please see the server logs", KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR, e);
  16. log.error("Exception processing", exc);
  17. SupressedExceptionLog.log(exc);
  18. sendBadResponse(channel, exc);
  19. }
  20. }

代码示例来源:origin: org.webpieces/http-common

  1. private void preconditions() {
  2. // If we haven't gotten the settings, let's wait a little bit because another thread
  3. // might have the settings frame and hasn't gotten around to processing it yet.
  4. try {
  5. Http2EngineImpl.log.info("Waiting for settings frame to arrive");
  6. if (!this.http2EngineImpl.settingsLatch.await(500, TimeUnit.MILLISECONDS))
  7. throw new GoAwayError(this.http2EngineImpl.lastClosedRemoteOriginatedStream().orElse(0), Http2ErrorCode.PROTOCOL_ERROR, Http2EngineImpl.wrapperGen.emptyWrapper());
  8. } catch (InterruptedException e) {
  9. Http2EngineImpl.log.error("Caught exception while waiting for settings frame", e);
  10. throw new GoAwayError(this.http2EngineImpl.lastClosedRemoteOriginatedStream().orElse(0), Http2ErrorCode.PROTOCOL_ERROR, Http2EngineImpl.wrapperGen.emptyWrapper());
  11. }
  12. }

代码示例来源:origin: org.webpieces/http-templating

  1. protected void put(HtmlTag tag) {
  2. HtmlTag htmlTag = tags.get(tag.getName());
  3. if(htmlTag != null)
  4. log.warn("You are overriding Tag="+tag.getName()+" from class="+htmlTag.getClass()+" to your class="+tag.getClass());
  5. else
  6. log.info("adding tag="+tag.getName());
  7. tags.put(tag.getName(), tag);
  8. }

代码示例来源:origin: org.webpieces/core-ssl

  1. private void logAndCheck(ByteBuffer encryptedData, SSLEngineResult result, ByteBuffer outBuffer, Status status, HandshakeStatus hsStatus, int i) {
  2. final ByteBuffer data = encryptedData;
  3. log.trace(()->mem+"[sockToEngine] unwrap done pos="+data.position()+" lim="+
  4. data.limit()+" status="+status+" hs="+hsStatus);
  5. if(i > 1000) {
  6. throw new RuntimeException(this+"Bug, stuck in loop, encryptedData="+encryptedData+" outBuffer="+outBuffer+
  7. " hsStatus="+hsStatus+" status="+status);
  8. } else if(status == Status.BUFFER_UNDERFLOW) {
  9. final ByteBuffer data1 = encryptedData;
  10. log.trace(()->"buffer underflow. data="+data1.remaining());
  11. }
  12. }

代码示例来源:origin: org.webpieces/core-channelmanager2

  1. log.warn(channel+"Overloaded channel. unregistering until YOU catch up you slowass(lol). num="+unackedByteCnt+" max="+channel.getMaxUnacked());
  2. unregisterSelectableChannel(channel, SelectionKey.OP_READ);
  3. log.warn(channel+"BOOM. you caught back up, reregistering for reads now. unackedCnt="+unackedCnt+" readThreshold="+channel.getReadThreshold());
  4. channel.registerForReads();
  5. apiLog.error(channel+" Exception on incoming data", t);
  6. return null;
  7. });

代码示例来源:origin: org.webpieces/core-statemachine

  1. /**
  2. * @param smState
  3. * @param evt
  4. */
  5. public void fireEvent(StateMachineState smState, Object evt)
  6. {
  7. TransitionImpl transition = evtToTransition.get(evt);
  8. if(transition == null) {
  9. log.debug(() -> smState+"No Transition: "+getName()+" -> <no transition found>, event="+evt);
  10. if(noTransitionListener != null)
  11. noTransitionListener.noTransitionFromEvent(smState.getCurrentState(), evt);
  12. return;
  13. }
  14. State nextState = transition.getEndState();
  15. if(log.isDebugEnabled())
  16. log.debug(() -> smState+"Transition: "+getName()+" -> "+nextState+", event="+evt);
  17. try {
  18. smState.setCurrentState(nextState);
  19. } catch(RuntimeException e) {
  20. log.warn(smState+"Transition FAILED: "+getName()+" -> "+nextState+", event="+evt);
  21. throw e;
  22. }
  23. }

代码示例来源:origin: org.webpieces/runtimecompile

  1. log.trace(()->"Loading class for "+name);
  2. resolveClass(applicationClass.javaClass);
  3. if(log.isDebugEnabled()) {
  4. long time = System.currentTimeMillis() - start;
  5. log.trace(()->time+"ms to load class "+name+" from cache");
  6. resolveClass(applicationClass.javaClass);
  7. if(log.isTraceEnabled()) {
  8. long time = System.currentTimeMillis() - start;
  9. log.trace(()->time+"ms to load class "+name);

代码示例来源:origin: org.webpieces/core-util

  1. /**
  2. * Log a message at the DEBUG level.
  3. *
  4. * Usage: log.debug(()->"my lazy log statement")
  5. *
  6. * @param msg the message string to be logged
  7. */
  8. public void debug(Supplier<String> msg) {
  9. if(isDebugEnabled())
  10. logger.debug(msg.get());
  11. }

代码示例来源:origin: org.webpieces/core-util

  1. public CompletableFuture<RESP> get() {
  2. log.debug(() -> "key:"+key+" start virtual single thread. ");
  3. CompletableFuture<RESP> fut = processor.get();
  4. log.debug(() -> "key:"+key+" halfway there. future needs to be acked to finish work and release virtual thread");
  5. return fut;
  6. }
  7. };

代码示例来源:origin: org.webpieces/core-util

  1. public <RESP> CompletableFuture<RESP> lock(Function<Lock, CompletableFuture<RESP>> processor) {
  2. int id = counter.getAndIncrement();
  3. String key = logId+id;
  4. if(permitQueue.backupSize() > queuedBackupWarnThreshold)
  5. log.warn("id:"+key+" Your lock is backing up with requests. either too much contention or deadlock occurred(either way, you should fix this)");
  6. Lock lock = new LockImpl(key);
  7. Supplier<CompletableFuture<RESP>> proxy = new Supplier<CompletableFuture<RESP>>() {
  8. public CompletableFuture<RESP> get() {
  9. log.info("key:"+key+" enter async sync block");
  10. CompletableFuture<RESP> fut = processor.apply(lock);
  11. return fut;
  12. }
  13. };
  14. log.info("key:"+key+" aboud to get lock or get queued");
  15. return permitQueue.runRequest(proxy);
  16. }

代码示例来源:origin: org.webpieces/core-channelmanager2

  1. @Override
  2. public void run() {
  3. try {
  4. running = true;
  5. runLoop();
  6. log.trace(()->"shutting down the PollingThread");
  7. selector.close();
  8. selector = null;
  9. thread = null;
  10. synchronized(JdkSelectorImpl.this) {
  11. running = false;
  12. JdkSelectorImpl.this.notifyAll();
  13. }
  14. } catch (Exception e) {
  15. log.error("Exception on ConnectionManager thread", e);
  16. }
  17. }
  18. }

代码示例来源:origin: org.webpieces/core-ssl

  1. private void logTrace(ByteBuffer encryptedData, Status status, HandshakeStatus hsStatus) {
  2. log.trace(()->mem+"[sockToEngine] reset pos="+encryptedData.position()+" lim="+encryptedData.limit()+" status="+status+" hs="+hsStatus);
  3. }

代码示例来源:origin: org.webpieces/core-util

  1. /**
  2. * Log an exception (throwable) at the DEBUG level with an
  3. * accompanying message.
  4. *
  5. * @param msg the message accompanying the exception
  6. * @param t the exception (throwable) to log
  7. */
  8. public void debug(Supplier<String> msg, Throwable t) {
  9. if(isDebugEnabled())
  10. logger.debug(msg.get(), t);
  11. }

代码示例来源:origin: org.webpieces/core-util

  1. private <RESP> CompletableFuture<RESP> release(RESP v, Throwable e) {
  2. log.debug(() -> "key:"+key+" end virtual single thread");
  3. //immediately release when future is complete
  4. queue.releasePermit();
  5. CompletableFuture<RESP> future = new CompletableFuture<RESP>();
  6. if (e != null) {
  7. future.completeExceptionally(e);
  8. } else
  9. future.complete(v);
  10. return future;
  11. }

代码示例来源:origin: org.webpieces/http1_1-client

  1. @Override
  2. public void farEndClosed(Channel channel) {
  3. log.info("far end closed");
  4. isClosed = true;
  5. }

相关文章