在Linux中,log4j.appender.R.File的默认根目录在哪里?

发布于 2024-09-10 14:11:07 字数 253 浏览 3 评论 0原文

在Windows中,当我使用以下文件路径时,log4j会将文件写入C:\eclipse\logs\appLog.log(我在Windows中使用eclipse作为IDE):

log4j.appender.R.File=logs/appLog.log

然后当我将jsp部署到apache tomcat时Linux服务器的日志文件存放在哪里? (我尽量避免使用绝对路径,因为我需要记住在部署到 Linux 后更改路径)提前致谢。

in windows, when I use the following File path, log4j will write the file to C:\eclipse\logs\appLog.log (I am using eclipse as the IDE in windows):

log4j.appender.R.File=logs/appLog.log

Then when I deploy the jsp to the apache tomcat in a Linux server, where does the log file go? (I try to avoid using absolute path because I will need to remember changing the path after deployed to linux) Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的黑色迷你裙 2024-09-17 14:11:07

在应用程序中使用相对本地磁盘文件系统路径是一个非常糟糕的主意。它们将相对于“当前工作目录”,即应用程序启动时当前打开的目录。它可以无处不在,并且这完全不受您的应用程序的控制。

始终使用以 / 开头的绝对本地磁盘文件系统路径。

Using relative local disk file system paths in an application is an extremely bad idea. They will be relative to the "current working directory", i.e. the directory which was currently opened when the application was started up. It can be everywhere and this is completely out of control from your application.

Always use absolute local disk file system paths starting with a leading /.

杯别 2024-09-17 14:11:07

虽然是一个老问题,但我添加了详细信息,以便未来的用户能够受益。

检查我的 git 项目,了解在多个环境中执行此操作的简单方法:

https://github.com/ varunachar/Log4J-多环境

Although an old question, I'm adding details so that future users can benefit.

Check my git project for an easy way to do it for multiple environments:

https://github.com/varunachar/Log4J-Multi-Environment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文