Java Reference
In-Depth Information
logger.disconnect();
}
else
System.out.println("cannot connect to file-based
logger");
logger
=
LoggerFact-
ory.newLogger(LoggerFactory.FILE);
if (logger.connect())
{
logger.log("test message #3");
logger.disconnect();
}
else
System.out.println("cannot connect to file-based
logger");
}
}
Followthesesteps(whichassumethattheJDKhasbeeninstalled)tocreatethe
log-
ging
package and
TestLogger
application, and to run this application:
1. Create a new directory and make this directory current.
2. Create a
logging
directory in the current directory.
directory.
ory.
8. Execute
javac TestLogger.java
,whichalsocompiles
logger
'ssource
files.
9. Execute
java TestLogger
.
After completing the final step, you should observe the following output from the
TestLogger
application: