Logging Guide for PlanNUS
Table of contents
Using Logging Tool in PlanNUS
LoggingTool
is available to use for accessible logging at the package src.main.java.seedu.duke.global
. LoggingTool
constructor takes in a parameter String
and FileHandler
. String
represents loggerName
and FileHandler
represents
the object fh
, which is the java API. initialise()
will automatically return a fully configured Logger
object
with the following parameters :
addHandler(fh)
logger
will log to an external file as defined byfh
setUseParentHandlers(false)
- Disables logging on the console output
setLevel(Level.INFO)
- Any message logged
Level.INFO
and above will be logged
- Any message logged
After initialising, the logger
can be used as per java API constraints. Below shows an example code snippet that can be used to initialise a logger
:
FileHandler fh = new FileHandler(<YOUR_LOG_FILE_NAME>);
Logger logger = new LoggingTool(<YOUR_LOGGER_NAME>,fh).initialize();