日志文件路径 [英] Path of log file
本文介绍了日志文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下方法创建了一个记录器:
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 ?
推荐答案
默认情况下,它不会将这些消息写入日志文件.
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);
根据您在FileHandler构造函数中提供的文件名和位置,它将创建文件并写入消息
Based on the file name and location which you are providing in the FileHandler constructor, it will create the file and write the message
这篇关于日志文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文