Yep, i did it, it works, but now i'v got an other problem, i can't use an 
appendFile with the rolling on size or by date.

Here is what I've done : 

<appender name="FileAppender" type="log4net.Appender.FileAppender"> 

                                 <file value="E:\\Log\\ArlSQL_Log\\ArlSql.log" 
/> 

                                 <lockingModel 
type="log4net.Appender.FileAppender+MinimalLock" /> 

                                 <layout type="log4net.Layout.PatternLayout" 
value="%d [%t] %-5p %c - %m%n" /> 

                </appender>

 

But for example, <maximumFileSize value="1MB" /> isn't usable with a 
type="log4net.Appender.FileAppender"> L

 

De : Florin Daneliuc [mailto:florin.danel...@iquestint.com] 
Envoyé : vendredi 23 octobre 2009 15:26
À : Log4NET User
Objet : RE: multi process settings

 

I think you can also instruct the logger to try to acquire the lock of the file 
and release it as soon as possible.

Anyway, for multiple process logging, a file is not the best way. Maiby an 
event log (windows) or syslog (nix) or a network sink might work better.

 

florin

 

________________________________

From: Jordan JBO. Bouclet [mailto:jbouc...@scotler.fr] 
Sent: Friday, October 23, 2009 12:55 PM
To: log4net-user@logging.apache.org
Subject: RE: multi process settings

Hi,

 

I have got a problem with the settings of log4net about multi access on a file.

My context : I'v got a dll wich log into a trace.log. That dll is used by 2 
different programs. When the first create the instance of log4net, the 2nd one 
can't write into the trace.log.

I can't find the right settings to do that. The best behavior would be to 
create a new file with YYYYMMdd-HH_mm_ss when the instance can't write into the 
file.

 

For now, I did, following the config-exemple from the apache site : 

 

        <log4net>

               <root>

                       <level value="ALL" />

                       <appender-ref ref="FileAppender" />

               </root>

               <appender name="FileAppender" 
type="log4net.Appender.RollingFileAppender">

                       <file value="E:\\Log\\Trace.log" />

                       <appendToFile value="True" />

                       <rollingStyle value="Date" />

                       <staticLogFileName value="false" />

                       <lockingModel 
type="log4net.Appender.FileAppender+MinimalLock " />

                       <datePattern value="yyyyMMdd-HHmm" />

                       <maxSizeRollBackups value="-1" />

                       <layout type="log4net.Layout.PatternLayout">

                               <conversionPattern value="%date [%-5level] : 
%message%newline" />

                       </layout>

               </appender>

               

        </log4net>

 

But I'm having an error with the 2nd instance wich is : 
System.TypeLoadException: Could not load type 
[log4net.Appender.FileAppender+MinimalLock ]. Tried assembly [log4net, 
Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821] and all 
loaded assemblies.

 

Is there a solution to that ? 

 

Thanks.

 

Reply via email to