Hey, he stole my logging
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ken_Hubacher
Posted On:   Tuesday, November 23, 2004 04:59 AM

I have a webapp that contains approx 10 different independent tools that is presented by and can be run from a web page. Each tool has very little to do with the other so I initialize logging for each tool and send logging to a separate log file. But I also have a set of common java classes that all tools use. My dilema is that all these tools run under a common JVM...the appserver, and if one tool is still running while another tool is invoked the logging will be redirected to the newly invoked log for both the tool just invoked as well as the tool that wes already running. I understand why this happens...because I'm reinitializing the log to a new file and the currently running tools context is switched since it   More>>

I have a webapp that contains approx 10 different independent tools that is presented by and can be run from a web page.




Each tool has very little to do with the other so I initialize logging for each tool and send logging to a separate log file. But I also have a set of common java classes that all tools use.



My dilema is that all these tools run under a common JVM...the appserver, and if one tool is still running while another tool is invoked the logging will be redirected to the newly invoked log for both the tool just invoked as well as the tool that wes already running. I understand why this happens...because I'm reinitializing the log to a new file and the currently running tools context is switched since it's within the same jvm.



So I can obviously limit the logging to each through the package (com.foo vs. com.bar) but then when I call my common classes I lose the logging within those classes because they fall under a different package structure.



Here's an example:



com.company.tools.tool1 >>> tool1.log

com.company.tools.tool2 >>> tool2.log

com.company.tools.tool3 >>> tool3.log

com.company.tools.common >>> logs to whatever tool calls it



In tool1, if I initialize it to restrict logging to com.company.tools.tool1 and do the same in tool2 etc... it restricts my logging but eliminates the logging whenever a tools.common class is called since it falls under a different package structure.



If I setup tool1,2 & 3 to initialize logging as com.company.tools, the when each tool calls into common it will be logged successfully but if two tools run at the same time the last one to initialize the logging will steal the context and all logging for both tools goes to that log.



I'm not sure if there's an easy way to get both a separate log for each tool that doesn't get it's context stolen & include logging from the common classes.



Thanks
Ken

   <<Less
About | Sitemap | Contact