I want to log data to a txt file, i.e. I will receive the data from the com port and then write it to the text file. Does this qualify as logging? or is logging referring to error logging? If the first case is true I guess I am supposed to use log4j as I have read that this is the standard for logging? However if this is not the case is it then ok to use FileWriter?
Share
Use
java.util.logging.Logger. Use the following steps:LoggerwithLogger.getLogger(name)(you define whatever logging name you want to use for your system).Logger.addHandler. For example, if you want to output the logs to a file, usejava.util.logging.FileHandler.Logger.getLogger(name).log().That’s it! The FileHandler will write your text file automatically. If you want to put the logs somewhere else (for example, a database), add a different Handler.