fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.logging.Level;
  4. import java.util.logging.Logger;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. Logger log=Logger.getAnonymousLogger();
  12. String[] examples={"short string", "rather long string"};
  13. for(String responseContent: examples) {
  14. log.info(() -> {
  15. System.out.println("Potentially expensive operation with "+responseContent);
  16. return responseContent;
  17. });
  18. log.setLevel(Level.SEVERE);
  19. }
  20. }
  21. }
Success #stdin #stdout #stderr 0.1s 712192KB
stdin
Standard input is empty
stdout
Potentially expensive operation with short string
stderr
Jan 27, 2017 7:51:11 PM Ideone main
INFO: short string