icarosp
icarosp

Reputation: 11

Multiple files in log4net with same logger

I'm currently working in a chat API, and I receive multiple requests at the same time, from different sessions, so its almost impossible to track each conversation separately, because it mixes with all the others logs from other conversations.

So I want to create a separated file for each session(conversation) dynamically, with the filename as the sessionId, but if I create multiple loggers, my application just freeze, because I can have more than 100 sessions simultaneously.

I have also tried to change the file path (programmatically) for each request with its id on it, but it also freezes the application after 1-2 hours.

Is there any solution for this problem?

Upvotes: 0

Views: 313

Answers (1)

Emond
Emond

Reputation: 50692

If these conversation files are so important, consider other options than logging. A database might be appropriate.

Another solution might be to parse the log files and split them into conversation files in a separate (logical?) process (perhaps later, after the session has ended.) This way the program doesn't need to keep track of many files at the same time and parsing can be done faster/more efficiently.

Upvotes: 1

Related Questions