Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Is there an element for setting up margins for a logging file in the app.config?
Is there also a way for putting the datestamp before the ".txt" extension because now it's looks like: InfoDebug_Logging_TestSimulator.txt.2011-05-20
I want it like this:
InfoDebug_Logging_TestSimulator_2011-05-20.txt
XML
<appender name="RollingFileAppender1" type="log4net.Appender.RollingFileAppender">
    <file value="Logging\InfoDebug_Logging_TestSimulator.txt" />
    <appendToFile value="true" />
    <!--<rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10000" />
    <staticLogFileName value="true" />-->
    <!-- Alternatively, roll on date -->
    <rollingStyle value="Date" />
    <param name="DatePattern1" value=".yyyy-MM-dd-HH.\t\x\t" />
    <maxSizeRollBackups value="20" />
    <maximumFileSize value="15MB" />
    <filter type="log4net.Filter.LevelRangeFilter">
    <acceptOnMatch value="true" />
    <levelMin value="DEBUG" />
    <levelMax value="FATAL" />
    </filter>
    <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date{HH:mm:ss.fff} %-5level %-32logger %-30M %message%newline" />
    </layout>
  </appender>

thanks in advance
Posted
Updated 14-Jun-11 18:47pm
v2

1 solution

.\t\x\t" could be the problem.

Change <file value="Logging\InfoDebug_Logging_TestSimulator.txt" />
and try using .\tx\t or <datePattern value="yyyyMMdd_HH'.txt'"/>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900