通过 FileAppender 进行日志记录

发布于 2024-09-12 14:26:15 字数 175 浏览 2 评论 0原文

这是一个简单的问题:

我正在尝试使用 log4net 将信息记录到文件中。我写 <文件值=“log-file.txt”/>到 app.config 中我的appender 标签中。现在想知道 log-file.txt 的位置以及它是自动创建还是我应该自己创建。

我正在使用 c# - wpf

here is an easy question coming:

i am trying to use log4net to log the infos on a file. i wrote
< file value="log-file.txt" /> into my appender tag in app.config. and now wondering where the log-file.txt is positioned and whether it is created automatically or i should create it by myself.

i am using c# - wpf

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

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

发布评论

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

评论(2

迟到的我 2024-09-19 14:26:15

它应该位于 Debug\Bin 或 Release\Bin 文件夹中。
如果不存在,请尝试指定完整路径。

It should be in the Debug\Bin or Release\Bin folder.
if its not there, try specifying full path.

原来分手还会想你 2024-09-19 14:26:15

如果该文件不存在,则会自动创建。
它可能要求应用程序对放置日志文件的文件夹具有写入权限。
正如 Orentet 提到的,这通常是 bin 文件夹。

The file will automatically be created if it doesn't exist.
It may require that the application has write permission to the folder where the logfile is placed.
As Orentet mentions this is normally the bin folder.

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