Nicko,

I have found that the anomaly in the custom log directories is caused by
having more than one instance of the application that uses l4n open at the
same time. 

Description: 

I declare a static instance of the logger in my code as follows:

private static ILog _l4nSystemLogger =
LogManager.GetLogger(System.Reflection.MethodBase.
                        GetCurrentMethod().DeclaringType);

I am not positive, but what I think is happening is that when the first
instance of the application is loading, the default directory is the
application path. After I load the application, the directory is pointing to
the custom path that was created using the custom pattern. When the second
instance of the application opens, instead of the logger path pointing to
the application path, it is pointing to the custom directory because the
logger is static, which causes the logger to create a new set of directories
because it does not 'see' that it is already pointing to the custom path. 

I could be way off on the reasoning, but I am sure that the multiple
instances are the root cause of the issue. Hope this helps with future
development. :)

Cheers!
Russ
 
p.s. the version is 1.2.9 beta


-----Original Message-----
From: Nicko Cadell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 28, 2006 10:15 AM
To: Log4NET User
Subject: RE: Custom Log File Directories

Russ,

While I don't have any specific suggestions can you try to recreate the
issue with log4net debugging enabled? Can you enable debugging using the
application's .config file rather than via the <log4net debug="true">,
for details see:
http://logging.apache.org/log4net/release/faq.html#internalDebug

If you can recreate the issue can you post the debug output generated.

Also which version of log4net are you using?

Cheers,
Nicko

> -----Original Message-----
> From: Russ Haley [mailto:[EMAIL PROTECTED] 
> Sent: 13 February 2006 19:42
> To: 'Log4NET User'
> Subject: Custom Log File Directories
> 
> Hello all,
> 
>  
> 
> I've been using l4n very successfully for the last 9 months 
> (holy crap, has it been that long?) with one small problem 
> pertaining to the custom directories that are created for the 
> log files. I am using custom date patterns to put log files 
> under directories named after the year and month that the log 
> files were created. So if I was to create a log file today 
> (feb 13, 2006) the file path would be as follows:
> 
>  
> 
> <root path>\SYSTEM\2006\February\20060213.SYSTEM
> 
>  
> 
> With the file being names 20060213.SYSTEM. This works for the 
> most part, but every now and then it has a bit of a hissy fit 
> and creates a folder named something like this:
> 
>  
> 
> 20060213.SYSTEM2006
> 
>  
> 
> It seems that somehow it appends the year to the filename and 
> then creates a directory out of it and then creates the 
> directory structure under the folder noted above like so:
> 
>  
> 
> <root path>\2006\February\20060213.SYSTEM2006\February\20060213.SYSTEM
> 
>  
> 
> From what I can tell, this happens the first time I start the 
> application after a reboot or something and then corrects 
> itself after the first run. Unfortunately, it isn't a 
> consistent problem and only occurs when my boss is standing 
> over me watching what's going on. : - {
> 
>  
> 
> Any suggestions other than locking my boss in his office (as 
> I've already been reprimanded for attempting it) would be 
> terrific.  Config settings below:
> 
>  
> 
> Cheers!
> 
> Russ
> 
>  
> 
>  
> 
>             <log4net debug="True">             
> 
>                         <appender name="SystemLog" 
> type="log4net.Appender.RollingFileAppender">                  
>             
> 
>                                     <param name="Threshold" 
> value="ALL" />
> 
>                                     <param 
> name="AppendToFile" value="true" />
> 
>                                     <param 
> name="RollingStyle" value="Date" />
> 
>                                     <param 
> name="MaxSizeRollBackups" value="10" />
> 
>                                     <param name="DatePattern" 
> value="yyyy\\MMMMMMMMM\\yyyyMMdd.\S\Y\S\T\E\M"/>              
>             
> 
>                                     <param 
> name="StaticLogFileName" value="False" />                     
>           
> 
>                                     <layout 
> type="log4net.Layout.PatternLayout">
> 
>                                                 <header 
> value="[BEGIN LOGGING AT %date ]%newline" 
> type="log4net.Util.PatternString" />
> 
>                                                 <footer 
> value="[END LOGGING]%newline" type="log4net.Util.PatternString" />
> 
>                                                 <param 
> name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
> 
>                                     </layout>
> 
>                         </appender>
> 
>                         
> 
>                         <root>                           
> 
>                                     <appender-ref 
> ref="SystemEventInfoLog"/>                                    
>                        
> 
>                         </root>                               
>                    
> 
>             </log4net>
> 
> 

Reply via email to