{"action":"opened","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/612","labels_url":"https://api.github.com/repos/NLog/NLog/issues/612/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/612/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/612/events","html_url":"https://github.com/NLog/NLog/issues/612","id":59247922,"number":612,"title":"Cached Layout Renderer is reevaluated when LoggingConfiguration is changed","user":{"login":"Quergo","id":11230027,"avatar_url":"https://avatars.githubusercontent.com/u/11230027?v=3","gravatar_id":"","url":"https://api.github.com/users/Quergo","html_url":"https://github.com/Quergo","followers_url":"https://api.github.com/users/Quergo/followers","following_url":"https://api.github.com/users/Quergo/following{/other_user}","gists_url":"https://api.github.com/users/Quergo/gists{/gist_id}","starred_url":"https://api.github.com/users/Quergo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Quergo/subscriptions","organizations_url":"https://api.github.com/users/Quergo/orgs","repos_url":"https://api.github.com/users/Quergo/repos","events_url":"https://api.github.com/users/Quergo/events{/privacy}","received_events_url":"https://api.github.com/users/Quergo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-27T15:09:13Z","updated_at":"2015-02-27T15:09:13Z","closed_at":null,"body":"Hi,\r\n\r\nI use Cached Layout Renderer to generate a separate log file each time my application starts. This is done by caching the date of the first logging call. \r\n\r\nThe target definition i use is:\r\n```xml\r\n<target name=\"default_logfile\" xsi:type=\"File\" fileName=\"${basedir}\\${date:cached=True:format=yyyy-MM-dd_HH-mm-ss}_Log.txt\" />\r\n```\r\n\r\nThis works fine until i start to add new logging targets at runtime. I make changes to the LoggingConfiguration like this:\r\n\r\n```C#\r\nLoggingConfiguration config = LogManager.Configuration;\r\n\r\nvar logFile = new FileTarget();\r\nconfig.AddTarget(dynamicTargetName, logFile);\r\n\r\nlogFile.FileName = dynamicFilePath + \"_Ext.log\";\r\nlogFile.Layout = @\"|${level:uppercase=true} @ ${logger:shortName=true}|:${date:format=yyyy-MM-dd HH\\:mm\\:ss} ${message} ${exception:stacktrace:separator=*}\";\r\n\r\nvar rule = new LoggingRule(\"*\", LogLevel.Trace, logFile);\r\nconfig.LoggingRules.Add(rule);\r\n\r\nLogManager.Configuration = config;\r\n```\r\n\r\nOn the one hand it correctly generates my dynamic logging target. But on the other, this seems to reevaluate the ${date:cached=True:format=yyyy-MM-dd_HH-mm-ss} expression which in consequence will generate a complete new logfile for my \"default_logfile\" target. The date used for the new logfile is the one of the first logging call after LoggingConfiguration reassignment.\r\n\r\nI also tested this:\r\n```C#\r\nLogManager.Configuration = LogManager.Configuration\r\n```\r\nwhich also triggers the reevaluation the cached layout render.\r\n\r\nI don't know if this is a bug or I am just doing something wrong with the dynamic logfile generation."}}