1. thread-safe require no variable (instance or static) that a thread may consider to
be the only one to update. Read-only member (as a logger instance) can be used safely.
2. you can configure log4j to add the thread id to the log, so that a simple grep will
extract all logs for a request.
3. other classes can be used as you designed them. If they're creating a new instance
for each request you will have no
thread-safe requirement to reach. If you use any singleton or static method you may
have to take threads into account.
Nico.
Hi
I am in the stage of implementing logging in my struts application. I
have been reading online but have some questions unanswered.
1. Action class should be thread-safe. Therefore no static variable, I
should just use a non-static variable to hold my logger?
2. In a multi-user web application, how can I keep logs from the same
class (same execution thread or same user request) stays together? I
envision them to be all messy in the log file when there's multiple user
requesting for the same action class.
3. About the thread safe issue with Actin class, that doesn't apply to
the other classes that action execute right? Those are treated as normal
java files.
Thanks
Sebastian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Our name has changed. Please update your address book to the following format:
[EMAIL PROTECTED].
This message contains information that may be privileged or confidential and is the
property of the Capgemini Group. It is intended only for the person to whom it is
addressed. If you are not the intended recipient, you are not authorized to read,
print, retain, copy, disseminate, distribute, or use this message or any part
thereof. If you receive this message in error, please notify the sender immediately
and delete all copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]