Hi St�phane, Thanks for your advice. I can see how this solution would retain the extension when rolling the log file by date, but how would I retain the .txt extension when rolling by size?
I think maybe there needs to be modifications in the RollingFileAppender class to support this behaviour. I might have a play and if I come up with a solution I'll submit it back to the project. Does anyone have any suggestions on how I should implement this? Maybe there should be a boolean property called something like RetainFileExtension and if this is set to true RollingFileAppender could make sure that the extension is always preserved when rolling the filenames. What do you think? Cheers, Josh. On 5/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Josh, > > I was facing the same problem a few months ago. It's possible with the > standard RollingFileAppender. > > If, for instance you want your log files to be named : > > C:\\Log\\MyTest-yyyy-mm-dd.txt, set the following parameters as follows : > > - In the \"File\" parameter, put the base name you want > (here, it will be \"C:/Log/MyTest\") > - In the \"DatePattern\" parameter, put \"-yyyy-MM-dd.\\tx\\t\" > > Note that you cannot simply set \".txt\" for the extension, as \"t\" is > a reserved character for the date formatting (will be transformed in \"P\" > or \"A\" depending if the corresponding time is AM or PM). > Also, if you want to have \".log\" instead of \".txt\" for your file > extension, you need to specifiy it as \".lo\\g\" > > > Example : > > > > > ! > > > > > > > > > > > > > > > > Hoping this will help you. > > Regards, > > St�phane Corteel > Technical and R&D Manager > ASK sa > [EMAIL PROTECTED] > wwww.ask.be > > > ---------------------------------------- > Hi All, > > I've been happily using log4net in my latest commerci! al C# .NET > > windows app....great work to all involved...it makes my life a lot > easier ;) > > My application relies on the RollingFileAppender for appending log > messages and rolling the log file (named \"log.txt\") on both date and > size. This is currently working very nicely. However, it has now been > requested by the powers that be that my application rolls its log > files using the naming convention > > \"log.1.txt\" and \"log.yyyymmdd.txt\" > > instead of > > \"log.txt.1\" and \"log.txt.yyyymmdd\". > > The reason being that the former is still easily opened using Notepad > due to it preserving the .txt file extension. > > Can log4net currently support this behaviour or do I need to make some > changes to the RollingFileAppender class? > > Thanks in advance, > > -- > Josh > > > > > -- Josh
