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 7579887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:46:51+00:00 2026-05-30T17:46:51+00:00

Ok,now I knew how to write a custom layoutRender write a class MylayoutRender inherits

  • 0

Ok,now I knew how to write a custom layoutRender

  1. write a class MylayoutRender inherits LayoutRenderer, in class,
  2. override Append method
  3. register custom layoutRenderer on startup

    ConfigurationItemFactory.Default.LayoutRenderers.RegisterDefinition("application", typeof(MyLayoutRenderer));

curently, I read the value from config

protected override void Append(StringBuilder builder, LogEventInfo logEvent)
    {
        var product = CommonMethods.ReadConfig("product");
        builder.Append(product); 
    }

how to set the value dynamically?

  • 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-30T17:46:52+00:00Added an answer on May 30, 2026 at 5:46 pm

    This answer contains an example of a LayoutRenderer that allows you to configure a parameter that says which config value to read.

    NLog config file to get configuration setting values from a web.config

    From what @DaveHogan posted, if you wrote your own LayoutRenderer and called it MyLayoutRenderer and wanted to log the “product” value, you would configure it something like this:

    ${MyLayoutRenderer:product}
    

    The key is the [DefaultParameter] attribute decorating the property of the LayoutRenderer that indicates which property to read from the configuration.

    This question (from me) shows an example of creating an NLog LayoutRenderer that takes a parameter and then uses that parameter as a key for a lookup. (The subject of the question is log4net, but I was posting an example of something I could do in NLog and wanted an answer showing how to something similar in log4net). Note that the example is for NLog 1.1. It will be slightly different in NLog 2.0.

    You might also find this link to the NLog code repository useful.

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

Sidebar

Related Questions

Long before I knew anything - not that I know much even now -
I knew C, Cpp, Java, Servlets, JSP and Objective C. Now, i want to
Still now I knew Its not Possible to change the contents of location bar
I have an assignment in my C programming class to write a program to
I thought I knew this already but now I'm not sure: Is all content
Now this isn't a question as to which of the technologies is better, since
Now I'm geting an error: 1>c:\development\document_manager\document_manager\storage_manager.h(7) : error C2079: 'storage_manager::db' uses undefined struct 'sqlite3'
Now I want to export a image in my Project to a folder ,
Now I'm sure this is super easy, I have a function called remove_deposit which
Now that Google App Engine natively supports Django 1.0, I updated with the following

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.