I have created an webapplication in Vb.net. In this am using multiple DLL for my business logic and used log4net to create a single log file for a whole application.
In this am using the following tags in webconfig to create new log files based on size.
Now am need to change log file creation in my application. Am doing some calculation in do while loop based some userid.. I need to create separate log file for each user. Is there any possibility to create new log file this kind of logic.
It's as simple as that. You just need to edit your logger to loop through all the users, check to see if a log for that user already exists. If it does, update the previous one. If it doesn't, create a new log file. Then do all the log 'stuff' and save.
t.lakshmi
Member
163 Points
80 Posts
New Log file for Each UserID
Jun 12, 2012 10:36 AM|LINK
Hai
I have created an webapplication in Vb.net. In this am using multiple DLL for my business logic and used log4net to create a single log file for a whole application.
In this am using the following tags in webconfig to create new log files based on size.
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="file" value="Log\Log.txt" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="-1" />
<maximumFileSize value="1000KB" />
<countDirection value="1" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ddMMMyyyy HH:mm:ss fff} %-5level %logger - %message%newline%newline" />
</layout>
</appender>
<logger name="PADS">
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</logger>
</log4net>
Now am need to change log file creation in my application. Am doing some calculation in do while loop based some userid.. I need to create separate log file for each user. Is there any possibility to create new log file this kind of logic.
Example:
While dtuser.row.count>0
userid=dtuser.rows(0)(0)
'Create new Log file in the name of userid
'Do calculation
'update Log
End While
bohunt
Member
482 Points
300 Posts
Re: New Log file for Each UserID
Jun 26, 2012 09:17 AM|LINK
It's as simple as that. You just need to edit your logger to loop through all the users, check to see if a log for that user already exists. If it does, update the previous one. If it doesn't, create a new log file. Then do all the log 'stuff' and save.
I hope my post helps.