c# - NLog file not writing -


i've been trying build app use nlog log file. code basic, not seeming work. have ideas? i've set correct things "copy always" well, in question. nlog doen't work on iis

code below.

main (including using statements show using them)

using system; using system.io; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.net; using system.configuration; using newtonsoft.json; using newtonsoft.json.linq; using nlog;  class program {      static void main(string[] args)     {         var logger = logmanager.getcurrentclasslogger();         logger.debug("xxxx");     } 

nlog.config

<?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/nlog.xsd"   xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">  <targets> <target name="file" xsi:type="file"     layout="${longdate} ${logger} ${message}"     filename="${basedir}/log/logfile.txt" /> </targets>  <rules>     <logger name="*" minlevel="debug" writeto="file" /> </rules> </nlog> 

app.config

<?xml version="1.0" encoding="utf-8" ?> <configuration>    <startup>        <supportedruntime version="v4.0" sku=".netframework,version=v4.5" />   </startup> <runtime>   <assemblybinding>     <dependentassembly>       <assemblyidentity name="nlog" publickeytoken="5120e14c03d0593c"   culture="neutral" />     <bindingredirect oldversion="0.0.0.0-3.2.1.0" newversion="3.2.1.0" />   </dependentassembly> </assemblybinding> </runtime>  </configuration> 

check whether process has write access ${basedir} location. also, if application running special folder, make sure process running elevated.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

sql - MySQL Custom calculate views -