Absolute Path in File Names

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Absolute Path in File Names

AeroClassics
I am new (just loaded up this tool today) and most makes sense. The only thing I see to be having a problem with is using an absolute pathname. I can use the ${basedir}/logs/logfile.txt fine. But if I try fileName="C:/Users/Public/AppName/logs/logFile.txt" nothing happens. No log file is created. in fact I seem to be only able to create a log file under my ${basedir}.

Where would I find in the documentation a list of the predefined variables? Things like ${basedir} etc.

Thanks!

Doug
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Absolute Path in File Names

Johan
IIS won't have access to paths other than the base. Security reasons
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Absolute Path in File Names

AeroClassics
That makes sense. But this is a console app and now a web app. So shouldn't I be able to specify pathing> Thanks, Doug
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Absolute Path in File Names

cottonmega
Hey this worked fine for me with this in config, I used backslash (\), where yours is forward slash (/)
Might give that a try just in case. Back or forward should be same at windows command prompt for anything else (cd command etc), but who knows, Cheers Roy Cotton

<targets>
 <target name="file" xsi:type="File" fileName="C:\@cottonmega\RSS\Docs\logs\rss.log"
         layout="${date}: ${message}" />
</targets>

<rules>
<logger name="*" minlevel="Info" writeTo="file" />
</rules>

C# caller (using wrapper and DI/IOC)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RSS.Infrastructure.Logging;



namespace RSS
{
    class Rss
    {
        readonly ILogger _logger;
        public  Rss(ILogger logger)
        {
            _logger = logger;
            _logger.LogInfo("Hey - I called the RSS Class to event log and file ");
           


        }
    }
}



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Absolute Path in File Names

alano
In reply to this post by AeroClassics
It took me ages to find the list of predefined ${} variables, so I thought I'd contribute to this thread by posting a link to these "Layout Renderers".
Loading...