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 Aleš Vojáček <al...@gmail.com> on 2008/07/17 14:11:17 UTC

XML configuration, windows service

Hi all,
I'm using

[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "conflog", Watch = true)]

in AssemblyInfo.cs

Almost everything works fine.
When I started service without config file there is no problem, simply service does not generate log.
Then I add config file into service directory, again everything works fine, it starts logging.
If I change config file then the configuration change and again everything is ok.

But when I delete config file then service still loging, I hoped that it stops logging.

How to do that, I know that it can be done using change config file 
instead of deleting it, but I need some more simple solution, because it 
wil be used by our customers which has no knowledge about editing files. 
I hoped that I will send them config file, which they simply copy into 
app directory, then they send me log file back and then delete config 
file. All without restarting service.

Can you someone help me with that?

A.

Re: XML configuration, windows service

Posted by Aleš Vojáček <al...@gmail.com>.
Hi,
thx for your post ;-)
we are doing it like your solution 2.
We have no gui cof for that service, but, we will add one soon, so we 
can add there.

Best Regards A.
Rennie Petersen napsal(a):
> Two suggestions:
>
> 1. The right way: In your service's admin program (I'm assuming it has one?) include support for cranking logging up and down using a drop-down box on the GUI, and sending the info to the service program which modifies the XML config file. This requires support in the admin program and the service program, but makes things very user-friendly - the customer does not even need to copy a settings file, they just crank logging up, wait a while, crank logging down and send you the log file.
>
> 2. A possible quick-and-dirty solution: Send your customers two XML config files, one to start logging and one to stop it. 
>
> Rennie
>
>
>   
>> -----Original Message-----
>> From: Aleš Vojáček [mailto:algidovo@gmail.com] 
>> Sent: 17. juli 2008 14:11
>> To: log4net-user@logging.apache.org
>> Subject: XML configuration, windows service
>>
>> Hi all,
>> I'm using
>>
>> [assembly: log4net.Config.XmlConfigurator(ConfigFileExtension 
>> = "conflog", Watch = true)]
>>
>> in AssemblyInfo.cs
>>
>> Almost everything works fine.
>> When I started service without config file there is no 
>> problem, simply service does not generate log.
>> Then I add config file into service directory, again 
>> everything works fine, it starts logging.
>> If I change config file then the configuration change and 
>> again everything is ok.
>>
>> But when I delete config file then service still loging, I 
>> hoped that it stops logging.
>>
>> How to do that, I know that it can be done using change 
>> config file instead of deleting it, but I need some more 
>> simple solution, because it wil be used by our customers 
>> which has no knowledge about editing files. 
>> I hoped that I will send them config file, which they simply 
>> copy into app directory, then they send me log file back and 
>> then delete config file. All without restarting service.
>>
>> Can you someone help me with that?
>>
>> A.
>>
>>
>>     
>
>   


RE: XML configuration, windows service

Posted by Rennie Petersen <rp...@merlinia.com>.
Two suggestions:

1. The right way: In your service's admin program (I'm assuming it has one?) include support for cranking logging up and down using a drop-down box on the GUI, and sending the info to the service program which modifies the XML config file. This requires support in the admin program and the service program, but makes things very user-friendly - the customer does not even need to copy a settings file, they just crank logging up, wait a while, crank logging down and send you the log file.

2. A possible quick-and-dirty solution: Send your customers two XML config files, one to start logging and one to stop it. 

Rennie


> -----Original Message-----
> From: Aleš Vojáček [mailto:algidovo@gmail.com] 
> Sent: 17. juli 2008 14:11
> To: log4net-user@logging.apache.org
> Subject: XML configuration, windows service
> 
> Hi all,
> I'm using
> 
> [assembly: log4net.Config.XmlConfigurator(ConfigFileExtension 
> = "conflog", Watch = true)]
> 
> in AssemblyInfo.cs
> 
> Almost everything works fine.
> When I started service without config file there is no 
> problem, simply service does not generate log.
> Then I add config file into service directory, again 
> everything works fine, it starts logging.
> If I change config file then the configuration change and 
> again everything is ok.
> 
> But when I delete config file then service still loging, I 
> hoped that it stops logging.
> 
> How to do that, I know that it can be done using change 
> config file instead of deleting it, but I need some more 
> simple solution, because it wil be used by our customers 
> which has no knowledge about editing files. 
> I hoped that I will send them config file, which they simply 
> copy into app directory, then they send me log file back and 
> then delete config file. All without restarting service.
> 
> Can you someone help me with that?
> 
> A.
> 
>