Advertisement
Krzysztof1985

Test class with logging

Feb 4th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. package pl.selfimproveit;
  2.  
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5.  
  6. public class Test {
  7.  
  8. private static final Logger logger = LoggerFactory.getLogger(Test.class);
  9.  
  10.     public static void main(String[] args) {
  11.        
  12.         String number = "nothing";
  13.         try {
  14.             int a = Integer.parseInt(number);
  15.             System.out.println("Parsed number is " + a);
  16.         }
  17.         catch (NumberFormatException ex) {
  18.             logger.error("Error parsing String "+number+ "to integer ",ex);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement