You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Sridhar S <sr...@gmail.com> on 2005/02/08 20:00:09 UTC

Unable to log unless ASPNET user is an Administrator in Win2000

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.

AW: Unable to log unless ASPNET user is an Administrator in Win2000

Posted by Patrick <pa...@gmx.at>.
Hi,

I am very interesting in your Soap Extensions. I would need in my diploma
thesis. Is it possible to send me a copy of your code? - This would be very
nice!

Regards

patrick


-----Ursprüngliche Nachricht-----
Von: Sridhar S [mailto:sridharsa@gmail.com] 
Gesendet: Dienstag, 08. Februar 2005 20:00
An: log4net-user@logging.apache.org
Betreff: Unable to log unless ASPNET user is an Administrator in Win2000

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_S
IZE).toString();
rollFileAppender.MaxSizeRollBackups =
int.Parse(AGENT_MODULE.getConfiguration(AgentConstants.CFG_TRANSACTION_LOG_N
UM_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_B
UFFER_SIZE).toString());
bfa.AddAppender(rollFileAppender);
bfa.Fix = FixFlags.Partial;
bfa.ActivateOptions();

Thanks for any help.
Sridhar.