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

  • Home
  • SEARCH
  • 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 6701955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:59:44+00:00 2026-05-26T06:59:44+00:00

I am creating different reports and trying to pass the report name and append

  • 0

I am creating different reports and trying to pass the report name and append it to the name of the log4net report. The report name will be different each time the report is run so it will be dynamically assigned.
I’ve tried using the LOG4NET.GLOBALCONTEXT.PROPERTIES("RptName") = sReportName", but all I get is a ‘null’ value in the report title.

class Program
{
    static void Main(string[] args)
    {
        log4net.Config.XmlConfigurator.Configure(); 
        log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));

        log4net.GlobalContext.**Properties("RptName")** = sReportName
        log.Info("this is an info message"); 
        Console.ReadLine(); 
    }
}
    <!--RollingFileAppender:  Provides output of all log entries to a file in the \logs directory
          Filename:  RSGetReport_yyyyMMdd_hh:mm:ss_processID.txt-->  
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <file type="log4net.Util.PatternString"  value="logs\RSGetReport_%date{yyyyMMdd}_%date{hhmmss}_%processid**_%property{myContext}.**txt" />
      <appendToFile value="true" />
      <rollingStyle value="Once" />
      <maxSizeRollBackups value="10" />
    <filter type="log4net.Filter.LevelRangeFilter">
      <levelMin value="ALL" />
    </filter>
      <maximumFileSize value="1MB" />
      <countDirection value="1" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>strong text
  • 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-26T06:59:45+00:00Added an answer on May 26, 2026 at 6:59 am

    You need to set the global property before configuring log4net. See also this question.

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

Sidebar

Related Questions

I am creating a website that has 5 different sub-sites each with the same
I am creating reports (with JasperReports ) in a Java based web application. Each
I'm using this php class ( http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php ) for creating the different sized images
What are the different approaches for creating scheduled tasks for web applications, with or
I have been looking into different systems for creating a fast cache in a
We are creating databases on demand and the databases can be created from different
I'm creating a multi-part web form in ASP.NET that uses Panels for the different
Suppose you are implementing a publication database and creating migrations to represent different publications.
I am creating ASP.NET textbox controls dynamically. I want to know the difference between
I have a Crystal 2008 report that will be deployed to an InfoView server.

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.