I am writing a simple sockets-chat on Java. For logging i use log4j. The back-end includes Server.class (handles general logic) and ClientListener.class (takes and operates with user's requests), both of them are threads.
The problem is:
I need to save logs into different directories depending on whether an event to be logged has occured in the Server or in a ClientListener of user X.
How I see a solution:
Serveralways logs into serv_base_dir/logs/logs.txtClientListenerslogs into folers with users data e.g. serv_base_dir/users/X/logs/logs.txt
The question is:
How to set a logs folder where they are to be saved in during server is running?
PS
I have read Log4j config - different logs to different files article, but it does not completely solve my problem because I need to set the folder during the runtime, not before compillation I would be greatful to any advice