Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7613087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:04:50+00:00 2026-05-31T02:04:50+00:00

My app creates a log for the application itself, so record when it was

  • 0

My app creates a log for the application itself, so record when it was activated, and what happened at an application level.

The application is centered around ‘profiles’ – the user loads a profile which tells the application where/when/what/how. So I also want to create a log for each profile, to record the progress each time the profile is run.

No problems so far… except that I want the profile log to be stored alongside the profile itself, so this means I need to configure NLog dynamically, so I can tell it the fileTarget path at runtime.

However, I was also wanting to store the standard layouts I want to use, as variables in NLog.config; this seems to be a common enough approach from what I have read.

However, at the following line

fileTarget.Layout = "${myLayout}"

…I get an ArgumentException:

LayoutRenderer cannot be found: 'myLayout'

At the moment, my layout variable is simply:

<variable name="myLayout" value="${message}" />

Is it a case that you can’t use variables to specify layout through the API? I would be surprised if that was the case. Or have I gone wrong somewhere?

The solution is simple enough – I can populate fileTarget.Layout with a manually-specified layout, but nevertheless, I’m keen to find out if Plan A could work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:04:51+00:00Added an answer on May 31, 2026 at 2:04 am

    It’s not possible if you’re using a compiled binary from NLog’s site, mainly because NLog doesn’t expose an API for accessing <variable> elements.

    You could suggest the author to add this ability, OR if you’re really keen about having this ability, then download and modify the source code. private string ExpandVariables(string input) in file XmlLoggingConfiguration.cs is what you’ll need to expose.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when i publish an app in vb.net it creates some files: application files directory,
I have created a small application which opens,reads and creates Excel files. The app
i have an RoR application Log, which similar to the book store app, my
var App = Ember.Application.create({ loaded:function(){ async(function(result) { data = SomeModel.create(result); App.model = data; console.log(data,
Since http is stateless, every request to an app creates a new object. How
I have an app that creates a variable number of ScatterviewItems based on which
I have a service app that creates AppDomain's during the course of its use
I have a PHP app that creates a CSV file which is forced to
I have a third-party app that creates HTML-based reports that I need to display.
I'm currently facing the following issue: My app dynamically creates images (320 x 480

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.