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 Russ Haley <rh...@axys.com> on 2006/02/13 20:41:34 UTC

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>