Path of log file [duplicate]

纵饮孤独 提交于 2019-12-25 03:55:11

问题


I have created a logger using:

private final static Logger logger = Logger.getLogger(newClass.class.getName());

but where can see the generated log file in my system/workspace ?


回答1:


By Default, it will not write those messages into a log file.

You will have to specify a file Handler to which the log messages to write.

Handler handler = new FileHandler("logfile.log", size, rt_cnt);
Logger.getLogger("").addHandler(handler);

Based on the file name and location which you are providing in the FileHandler constructor, it will create the file and write the message



来源:https://stackoverflow.com/questions/25545861/path-of-log-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!