I'm not sure this is a valid way of asking this question. I implemented logging using log4net, I was able to create a log file, and can look for the information in log file. So far I didn't implement the user profiles, I was asked to create log files based on the user with the format of [AID_YYYYMMDD]. Please someone suggest me the best way to learn log4net and implement the user profile based file name.
-
No, it's not a valid way of asking a question. There is no "?"djv– djv2016-05-24 14:36:44 +00:00Commented May 24, 2016 at 14:36
-
Each log4net appender can only write to one file at a time. If you want to have multiple open files - ie one per user - these options come to mind. 1) have one appender per user, defined programatically. This will probably not scale very well. 2) Set the file on the appender on a per-call basis, using a lock. This will have immediate performance impact and won't scale either. Your best option is to store the user info in the log, and then partition the logs per-user in post-processing.stuartd– stuartd2016-05-24 15:22:16 +00:00Commented May 24, 2016 at 15:22
-
did you tried using Enterprise Library ?Kiquenet– Kiquenet2016-06-21 07:02:03 +00:00Commented Jun 21, 2016 at 7:02
Add a comment
|
1 Answer
Log4Net has aspnet-request to get the Current User. You will need to format the way you want it.
%aspnet-request{AUTH_USER}
4 Comments
Krishna
Thank you win, I want to know how can I create a file for every user based on the name and how can I say the application to look in the application, whether the file name is already existing and if it's not existing create a new one, and log the information into the associated log file based on the user.
Win
Wow! Each user has own log file! It could be very bad design. Please do not do that.
Kiquenet
@Win which is better design ? why bad own logfile for each user ?
Win
Storing log in database is a best option. Mainly, you can filter them and review those logs easily.