You just need to make sure you call it as early as possible in some 
initialization code.  Here's the line I'm using in sharepoint:

log4net.Config.XmlConfigurator.Configure(new FileInfo(webConfigPath));

Another way to do it is to use an assembly attribute.  I use this in a windows 
service:

[assembly: log4net.Config.XmlConfigurator(Watch=true)]

Also, check out the configuration page:
http://logging.apache.org/log4net/release/manual/configuration.html 

- Tomas


-----Original Message-----
From: Velicu [mailto:mvel...@thermalsystems.ca] 
Sent: Friday, March 05, 2010 4:41 PM
To: log4net-user@logging.apache.org
Subject: RE: net4log click once projects


Thank you for the answer !

Where I have to put this xmlconfigurator. If you have some code , pleasee....

Regards,
Mihai


Tomas Ramirez wrote:
> 
> When this happened to me, it was because log4net couldn't find the 
> config file.  I specified it directly in XmlConfigurator.Configure and 
> that solved the problem.  There are other ways to do it too.
> 
> - Tomas
> 
> -----Original Message-----
> From: Velicu [mailto:mvel...@thermalsystems.ca]
> Sent: Friday, March 05, 2010 4:23 PM
> To: log4net-user@logging.apache.org
> Subject: net4log click once projects
> 
> 
> Hi !
> 
> I have an application where I log errors with log4net.
> If i run it from Visual studio is ok.If I deployed with click once is 
> not working.Is not creation the file.
> 
> The config.log4net.xml is:
> 
> <?xml version="1.0" encoding="utf-8" ?> <log4net>
>   <appender name="Console" type="log4net.Appender.ConsoleAppender">
>     <layout type="log4net.Layout.PatternLayout">
>       <!-- Pattern to output the caller's file name and line number -->
>       <conversionPattern value="%5level [%thread] (%file:%line) - 
> %message%newline" />
>     </layout>
>   </appender>
> 
>   <appender name="RollingFile"
> type="log4net.Appender.RollingFileAppender">
>     <!--    <threshold value="Error" /> -->
>     <file value="c:\Temp\myfile.log" />
>     <appendToFile value="true" />
>     <rollingStyle value="Composite" />
>     <maximumFileSize value="1MB" />
>     <maxSizeRollBackups value="-1" />
>     <datePattern value="'.'yyyyMMdd'.log'" />
>     <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
> 
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%date %level %thread %logger - 
> %message%newline" />
>     </layout>
>   </appender>
> 
>   <root>
>     <level value="Error" />
>     <appender-ref ref="Console" />
>     <appender-ref ref="RollingFile" />
>   </root>
> 
>  
> </log4net>
> 
> 
> What is wrong ?
> 
> Thank you !
> Mihai
> 
> 
> --
> View this message in context:
> http://old.nabble.com/net4log-click-once-projects-tp27800445p27800445.
> html Sent from the Log4net - Users mailing list archive at Nabble.com.
> 
> 
> 

--
View this message in context: 
http://old.nabble.com/net4log-click-once-projects-tp27800445p27800563.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to