RE: One log per application run

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: One log per application run

sellis
Hi,

I'm trying to have one log per application run. My file name has date format yyyy-MM-dd_HHmm. During the running of the application when the time changes it creates a new log file. Is there any way to keep the date format and only have one logfile per run?

Thank you for the support. I love nLog!

Steve


 <variable name="GeneralFileName" value="${basedir}/logs/${date:format=yyyy-MM-dd_HHmm}_WSJobProcessing.log"/>

    <targets async="true">
      <target name="fileAsGeneral"
              xsi:type="FilteringWrapper" condition="level==LogLevel.Debug or level==LogLevel.Info or level==LogLevel.Warn  or level==LogLevel.Error or level==LogLevel.Fatal">

        <target xsi:type="File"
                fileName="${GeneralFileName}"
                layout="${GeneralLayout}"
                archiveFileName="${GeneralArchiveFileName}"
                archiveEvery="Day"
                archiveNumbering="Rolling"
                maxArchiveFiles="7"
                concurrentWrites="true"
                keepFileOpen="false"
                encoding="iso-8859-2" />
      </target>
Reply | Threaded
Open this post in threaded view
|

RE: One log per application run

Jason LaFlair
Administrator
Take a look at the cache attribute:

http://nlog-project.org/wiki/Cached_layout_renderer
Reply | Threaded
Open this post in threaded view
|

RE: One log per application run

sellis
Thank you. It worked perfect!

Steve
Reply | Threaded
Open this post in threaded view
|

RE: One log per application run

crotella
In reply to this post by Jason LaFlair
Do you have an example how to use the cache i can't seem to get it to work correctly, i still get multiple log files when i use the time in the file name

thanks
Reply | Threaded
Open this post in threaded view
|

RE: One log per application run

sellis
Hi,

I can send you an example early next week. I'm currently on vacation and no access to my project. Feel free to send me your current setup and I can look at it.

Best, Steve
Reply | Threaded
Open this post in threaded view
|

Re: One log per application run

crotella
No worries already figured it out thanks 

Chad Rotella
Rotella Software

On 2012-04-20, at 11:08 AM, "sellis [via NLog Forum]" <[hidden email]> wrote:

Hi,

I can send you an example early next week. I'm currently on vacation and no access to my project. Feel free to send me your current setup and I can look at it.

Best, Steve


If you reply to this email, your message will be added to the discussion below:
http://nlog-forum.1685105.n2.nabble.com/RE-One-log-per-application-run-tp7348344p7484766.html
To unsubscribe from RE: One log per application run, click here.
NAML