Guest User

Untitled

a guest
Jul 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. //Logging.scala
  2. package corund.run
  3.  
  4. import org.apache.log4j.BasicConfigurator
  5. import org.apache.log4j.Level
  6. import corund.logger.Logger
  7.  
  8. object Logging {
  9. def main(args: Array[String]) {
  10. BasicConfigurator.configure()
  11. org.apache.log4j.Logger.getRootLogger().setLevel(Level.WARN)
  12. val logger = Logger("corund.run.Logging")
  13.  
  14. class Data(str: String) {
  15. def expensive() = {
  16. println("Invoked! - " + str)
  17. str
  18. }
  19. }
  20.  
  21. val data = new Data("expensive object")
  22.  
  23. logger.debug("debug: " + data.expensive())
  24. logger.info("info: " + data.expensive())
  25. logger.warn("warn: " + data.expensive())
  26. logger.error("error: " + data.expensive())
  27. }
  28. }
Add Comment
Please, Sign In to add comment