I would like to enter my application consisting of several classes. I would like to have one .txt log file at the end. So I make one static instance of the log, and I made FileHandler for it in the same class. Since I would like to have one file, I set the second argument to true in FileHandler to be able to add a log file while logging.
public class MyLogging { static Logger logger; public Handler fileHandler; Formatter plainText; public MyLogging() throws IOException{
After that I created other registrars. I know that I have to specify one registrar for each class. Therefore, I only do logger (without FileHandler) for each class. But all registrars refer to the same class (not for the class where I created the registrar). For example:
public class Test1 { static Logger logger; public Test1()throws IOException { logger = Logger.getLogger(MyLogging.class.getName()); }
Although logging has been done, I'm not sure if this is the right solution. Can you give me some tips on how to record through multiple classes using java.util.logging?
java logging java.util.logging
Jozsef garab
source share