You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Charlie Toohey <ct...@pacbell.net> on 2003/04/11 20:37:00 UTC

design question

I am faithfully written my business layer classes, so that they are 
completely independent of any webapp stuff, i.e. no Struts framework classes 
or Servlet API classes are known to these classes.

My question has to do with logging. I am using log4j and Nested Diagnostic 
Context to include the client IP address and session id with each log entry. 
But since my business objects don't know anything about webapp stuff, they 
don't have the client IP address or session id to push onto the log4j NDC. 
Consequently, in the log file, I can follow a particular client or session up 
until the point of the log entries from my business objects.

Would it be a gross violation of design principle to pass the client IP 
address and session id to a business class contructor, solely for the purpose 
of logging ? Or, is there a cleaner way to do this ?

Also, while on this topic, does anyone using log4j use it from within their 
.jsp files, or do you just use application.log in those ? I'm trying to keep 
any Java code out of my .jsp's, but I'm using log4j for logging, so I'm 
confronted with this issue -- or is there an existing tag library for log4j 
out there anywhere ?

Thanks for any help, suggestions !

- Charlie



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org