Less
Less

Reputation: 3207

Separate logs for multiple instances of the same process?

I have a java console application that can be run simultaneously by multiple users, but I need separate log for each of these java processes. It would be run on the same machine... I'm using slf4j with log4j.

Is this possible in any way?

Thanks.

Upvotes: 1

Views: 412

Answers (1)

Zéychin
Zéychin

Reputation: 4205

See this link on how to setup multiple log files:

http://www.jguru.com/faq/view.jsp?EID=1311014

I think something like this should work, since user names are unique:

If you just want one log for each user, you could just make different logs for different user names in your configuration file automatically when a user first opens your application (say, User1Log,User2Log... et cetera), and then use some code like this to specify which log to use from within your application:

Logger logger= Logger.getLogger(System.getProperty("user.name") + "Log");

So, someone logged in under User1 will have a log tied to User1Log in your configuration file.

Upvotes: 1

Related Questions