- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
为什么我不能在我的生产服务器上使用 ${basedir} nlog.config?如果我使用 fileName="${basedir}/logs/${shortdate}.log"
,nlog 不会记录消息信息,但是如果我更改为类似 fileName="C :/logs/${shortdate}.log"
它将记录消息信息
我的 nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="f" />
</rules>
</nlog>
Controller :
public class HomeController : Controller
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public ActionResult Index()
{
logger.Debug("Test NLog");
return View();
}
}
最佳答案
此问题与文件权限有关。简短的故事:运行 Web 应用程序的用户没有写入日志文件的权限。
根据 .NET 的版本和 IIS 的版本,可能有多种用户。
对于 IIS 6,我会说 Web 应用程序作为 NETWORK SERVICE
帐户运行。
因此,您需要授予该用户写入/修改 logs
文件夹(我假设它是网络根目录的子文件夹)的权限。如果您希望 NLog 自动创建 logs
文件夹,则需要将这些权限授予 Web 根目录。
关于c# - 为什么 ${basedir} NLog 配置不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23729629/
我刚刚更新了我的项目以包含最新版本的 gradle,但是现在我收到了这个黄色错误。 Gradle 'App' 项目刷新失败: path 和 baseDir 都不能为 null 或空字符串。 path=
gradle 中是否有 ANT 等效的 basedir 属性? ${basedir} 我正在尝试获取构建脚本所在目录的名称。 先感谢您! 最佳答案 根据您的确切需求,您可以使用 buildFile.p
运行我的tomcat时出现以下错误。 The BASEDIR environment variable is not defined correctly This environment variab
在我的项目的 build.xml 中,我定义了一个属性: ${somedir.dir}的值将是绝对路径:/home/myuser/my_project/some_dir . 我需要的只是相对路径 .
我不知道如何 browserify basedir option作品.. 注:我对整个basedir的理解可能有误概念,因为我来自 RequireJS(想想 baseUrl)。 编辑 确实我错了,但你
我有一个具有以下结构的多模块项目: -parent -module1 -module2 -src -main -javadoc
我正在使用本地存储库,如 Maven: add a dependency to a jar by relative path 中所述。 . repository-url 在最顶层的 pom.xml 中
我正在使用 Maven 程序集插件来压缩我的 Web 应用程序 dist 文件夹。我用这个descriptorRef文件: webapp-build zip
因此继续: Linking how PHP/HTML 请检查我接受的答案,我使用了 zneak 附带的“BASEDIR”解决方案。 现在我遇到了另一个问题..在我的 ajax_framework.js
我如何将我的 basedir 替换为一个\到一个 basedir 与\\? 我试过: org.apache.maven.plugins maven-e
我正在使用 Apache Ant 进行一些项目,我的项目布局如下: project/build.xml project/properties/build.properties project/tool
我正在尝试使用 maven 对 springboot 项目进行 dockerize。 所以我运行了一个命令 mvn package -Pdocker '-Dmaven.test.skip=true'
环境是Ubuntu 12 我有同一版本的两个不同版本。 位于/media/CM10/custom 下另一个在/home/malachi/CM10/android/system 我有一个专门的 buil
我有一个项目列表,每个项目都有 ant 构建脚本,我需要编写另一个 ant 脚本来调用所有其他脚本(即:从一个构建脚本构建所有项目),我想到了这样的事情:
我有一个 SVN externals 文件夹,其中包含许多名为 *Plugin 的文件夹,然后在每个文件夹中都有一个 modules 文件夹和一个 binaries 文件夹。 我的问题是,在我的构建任
我按照本指南中的说明进行操作: http://www.ducea.com/2006/11/06/identifying-mysql-slow-queries/ 本指南介绍如何为慢速查询(即执行时间最长
我的项目有以下结构 | prj | a1_module |src |pom | a2_module |src |pom | lib
我有使用 NLog 的 Windows 窗体应用程序 NET 4.5 (VS 2013)。 我有目标: LogManager.Configuration.AllTargets.To
为什么我不能在我的生产服务器上使用 ${basedir} nlog.config?如果我使用 fileName="${basedir}/logs/${shortdate}.log",nlog 不会记录
除非我完全错过它,否则我的印象是 NLog documentation在其示例中使用 ${basedir},但未解释其位置。 我在哪里可以找到列出所有可能的选项和有意义的描述的信息? 我定义了这个配置
我是一名优秀的程序员,十分优秀!