Your tasks for this assignment are to: How you choose to incorporate logging into your program is up to you, subject to

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Your tasks for this assignment are to: How you choose to incorporate logging into your program is up to you, subject to

Post by answerhappygod »

Your tasks for this assignment are to:
How you choose to incorporate logging into your program is up toyou, subject to the constraints noted below. The LearningMaterials page references several resources that you mightfind useful as you begin thinking about how to implement logging inyour program.
Constraints for generating logs:
Constraints for parsing logs:
Please submit:
________________________________
That is the instructions for the assignment. I already have thiscode but it is not working. Can anyone help?
testLogging.java
import java.util.logging.Level;
public class testLogging { public static voidmain(String[] args) { try{ testingLog testLog = newtestingLog("log.txt"); testLog.logger.setLevel(Level.WARNING); testLog.logger.info("Info Message"); testLog.logger.warning("WarningMessage"); testLog.logger.severe("SevereMessage"); } catch(Exception e) { } }}
testingLog.java
import java.io.File;import java.io.IOException;import java.util.logging.FileHandler;import java.util.logging.Logger;import java.util.logging.SimpleFormatter;
public class testingLog { public Logger logger; FileHandler testFile; public Log(String file_name) throwsSecurityException, IOException { File fileTest = newFile(file_name); if(!fileTest.exists()) { fileTest.createNewFile(); } testFile = newFileHandler(file_name, true); logger =Logger.getLogger("Test"); logger.addHandler(testFile); SimpleFormatter logFormatter= new SimpleFormatter(); testFile.setFormatter(logFormatter); }
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply