0

i need to create file date wise ..though folder is CREATING NOW .. but need to put date wise file in run time folder

String logfile = t.FileName.ToString() + "/" + LoginID + "DateTime.ToString("yyyyMMdd").txt";

          t.FileName = logfile;

LoginID is value taken from database ..and changes folder on fly ..but need to create text file .. I am stucked here ..Any Help ???????

2
Contributors
4
Replies
14
Views
4 Years
Discussion Span
Last Post by erum
0

Can You post the entire code...

By the way try this:

String logfile = t.FileName.ToString() + "/" + LoginID + DateTime.ToString("yyyyMMdd")+".txt";

0

on following line it gives error
logfile = logfile + "/" + LoginID + "/" + System.DateTime.ToString("yyyyMMdd") + ".txt";
Compiler Error Message: CS0120: An object reference is required for the non-static field, method, or property 'System.DateTime.ToString(string)'

0

Modify as:

String logfile = t.FileName.ToString() + "/" + LoginID + DateTime.Now.ToString("yyyyMMdd")+".txt";

or,

String logfile = t.FileName.ToString() + "/" + LoginID + DateTime.Now.ToShortDateString()+".txt";

0

i mentioned in nlog.config in both ways

1.<target name="file" xsi:type="File" filename="EnwayLog\${date:format=yyMMdd}\${shortdate}.txt"/>
2.<target name="file" xsi:type="File" filename="EnwayLog/${date:format=yyMMdd}/${shortdate}.txt"/>

but its not creating in any way any helpppppppppp

yesterday i write in nlog.config as following

<target name="file" xsi:type="File" filename="EnwayLog\${shortdate}\${shortdate}.txt" />

and it created folder 2013-04-15 and then date file and write logging in it

Now today i open My project run it (Visual studio 2008) ..it not creating today's folder ..

can u help me if not any problem

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.