Hi,
I am using Log4j for a web oriented project, where i have to log the
messages with logged in user id and his name.
Each and every time i don't want to pass the userid and username from
the session like below.
logger.debug("<userid>","<username>","<messages.....>");//i don't want
to do this
I want to use something similar to below statement. But in the log file i
have to see the userid and user name
logger.debug("<messages.....>");//i want to do this
I tried to use MDC and NDC, but for each and every call i need to set this
value before making a call....
MDC.put("userid',<....>);
MDC.put("username',<....>);
Only for one time i want to set this value, after that i don't want to do
that. If you know any design patterns for this it will be of great help.
regards
sri