Hi Friends,

I will using Log4net in my application, Log file is created fine. Now i need to create folder based on the month and year

I mean
This month is July i need to create a folder name is Jul2010 then start next month automatlly create a folder for Aug2010
inside of every folder to create log file based on that current month using log4net...

Anyone help me..


Thanks

Recommended Answers

All 2 Replies

Here's how you create the folder

Dim ThisFolder As String
Dim LogFolder As String
Dim Year As String
Dim Month As String

Year = DateTime.Now.Year.ToString
Month = DateTime.Now.ToString("MMM")
If Month.Length > 3 Then
  Month = Month.Substring(0, 3)
End If
ThisFolder = Month & Year

LogFolder = "C:\LogRoot\" & ThisFolder & "\"
Directory.CreateDirectory(LogFolder)

I'm not sure how you tell to Log4Net which folder to use but you can probably figure it out.

HTH

Thanks for your reply,

I`m using Asp.Net and Vb.Net Codebehind..
I will create XML file for Log4Net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.