Hi,
   I have all my log4net settings in a configuration file except for the
header. This is because I want to output the product version information
at the beginning of each log file. This version info is only available
to me at runtime. How can I set the Header programmatically?

I tried the following but it doesn't work...

ILog iLog = LogManager.GetLogger(typeof(ICOLogger));
ILoggerRepository repository = iLog.Logger.Repository;
foreach (IAppender appender in
((log4net.Repository.Hierarchy.Hierarchy)repository).Root.Appenders)
{
        if (appender is RollingFileAppender)
        {
                PatternLayout patternLayout =
(PatternLayout)((RollingFileAppender)appender).Layout;
                patternLayout.Header = "Version 1.1.2";
      }
}

Thanks,
Satish

Reply via email to