I'm trying to log to a file in Java, so I looked here and wrote the following code:
private static final Logger log = Logger.getLogger( QualityGatesProvider.class.getName() );
//some other code
FileHandler fh = new FileHandler("/Users/me/.jenkins/myLogs");
log.addHandler(fh);
However, on the line FileHandler fh = new FileHandler("/Users/me/.jenkins/myLogs");
, I get this:
unreported exception java.io.IOException; must be caught or declared to be thrown
Any idea what could be wrong with the code?