logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radovan Raszka" <ras...@hasam.cz>
Subject RE: Log4net in a windows service
Date Fri, 03 Oct 2008 14:18:48 GMT
Hello,
problem is usually caused by wrong config file location. If you run
windows service, then service's current directory is
%systemroot%\system32, not directory, where service's EXE is located on
the harddisk. Because your config file is referenced by relative path,
it can be searched in wrong location.
I prefer configure log4net using app.config file or by special xml file,
whose location can be got using service's EXE location
(Assembly.GetExecutingAssembly().Location)
Radovan Raszka


________________________________

	From: Jeegnesh Sheth [mailto:jsheth@src-solutions.com] 
	Sent: Friday, October 03, 2008 3:58 PM
	To: log4net-user@logging.apache.org
	Subject: Log4net in a windows service
	
	

	Hi,

	I have a logging DLL which uses log4net to log to a database. I
have c# application which calls this logging DLL and log to the
database. Within my logging DLL I perform additional work and hence it
acts as a wrapper for log4net.

	 

	In my C# windows service project, in assemblyinfo.cs I added 

	 

	Assembly:
log4net.Config.XmlConfigurator(ConfigFile:="mywindowsservice.dll.config"
, Watch:=True)

	 

	This config file is where I set the appeneder. If I run my unit
test it seems to work but it does not work in as a windows service. I am
using system admin privileges so it is not an issue of previlige.

	 

	Any thoughts?


Mime
View raw message