如题,我是在tomcat
启动的服务,其中某HTTP接口代码中使用了new File("/usr/local/log/")
,经过调用file
的getCanonicalPath
方法,得到完整目录:D:\user\local\log\
。这个如何理解?为什么是D盘?和tomcat
所在路径有关吧?
我在log4j.properties
文件这样配置:log4j.appender.DailyRollingFile.File=/usr/local/log/meal.log
,在windows
机器就会将日志生成到D:\user\local\log\
目录下。
因为你的程序运行在 D 盘,当前盘符是
D:
。你换个盘运行试一下。