Hi all,
I have written a C# SOAPExtension class that I use to log request and
response data to a log file using log4net 1.2. I use the
BufferingForwardingAppender and the RollingFileAppender classes.

The logs turn up fine in Win2003 and WinXP. In Win 2000, no log files
are created unless I add the ASPNET user to Administrators group.

I do not use the EventLogAppender in any way (I mention this as I read
the note in FAQ regarding the same).

All appenders are created and added to loggers programmatically. I
start by doing a BasicConfigurator.Configure();

The code that I use to create the appenders are as follows:
RollingFileAppender rollFileAppender = new RollingFileAppender();
rollFileAppender.AppendToFile = true;
rollFileAppender.File =
AGENT_MODULE.getConfiguration(AgentConstants.CFG_LOG_FILE_PATH).toString()
+ @"\agent-transaction-" + actualWebServiceName + ".log";
rollFileAppender.Layout = new PatternLayout(TX_LOG_PATTERN);
rollFileAppender.MaximumFileSize
=AGENT_MODULE.getConfiguration(AgentConstants.CFG_TRANSACTION_LOG_MAX_FILE_SIZE).toString();
rollFileAppender.MaxSizeRollBackups =
int.Parse(AGENT_MODULE.getConfiguration(AgentConstants.CFG_TRANSACTION_LOG_NUM_MAX_BACKUP_FILES).toString());
rollFileAppender.Name = TX_APPENDER_NAME + actualWebServiceName;
rollFileAppender.RollingStyle = RollingFileAppender.RollingMode.Size;
rollFileAppender.StaticLogFileName = true;
rollFileAppender.Threshold = Level.INFO;
rollFileAppender.ActivateOptions();

BufferingForwardingAppender bfa = new BufferingForwardingAppender();
bfa.Lossy = false;
bfa.Name = TX_BUFFER_APPENDER_NAME + actualWebServiceName;
bfa.BufferSize =
int.Parse(AGENT_MODULE.getConfiguration(AgentConstants.CFG_TRANSACTION_LOG_BUFFER_SIZE).toString());
bfa.AddAppender(rollFileAppender);
bfa.Fix = FixFlags.Partial;
bfa.ActivateOptions();

Thanks for any help.
Sridhar.

Reply via email to