Avoiding createDirs="true" by creating the log dir just once?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Avoiding createDirs="true" by creating the log dir just once?

SkyDiver
Hi,

First post, so it's a good moment to say I absolutely love this project - it's very professional. Thank you!

I happen to have a project with several files being logged to the same dir (logging data to these files consumes a lot of time).
I read on this site that avoiding createDirs="true" may improve performance, so I was wondering if it is possible to create the directory only once at application startup, e.g.: something like the <startup> node in the below example?

Thanks!

---------------------------------

<nlog ...>
        <variable name="log_dir" value="${basedir}/logs/${date}"/>

        <startup>
                <create_dir dirName="${log_dir}" />
        </startup>

       
        <targets>
                <target name="file1" xsi:type="File" fileName="${log_dir}/file1.log" />
                <target name="file2" xsi:type="File" fileName="${log_dir}/file2.log" />
                <target name="file3" xsi:type="File" fileName="${log_dir}/file3.log" />
        </targets>
        ...
</nlog>