Howdy, >First of all, forgive me if this is trivial, but investigating the source, >and various web resources, I was not capable to find the answer, so I hope >you can help me.
Did you read the Logger configuration reference in the tomcat 4.1 docs? >I saw that Tomcat has a different log for each deployed web application. That's one possible configuration, but not the default, and certainly not necessary. >And I also saw that there is a log (example: localhost_log.2003-06-14.txt) >that is the server log. Again, that's one possible configuration, happens to be the default, and not required. It is a common configuration in production for the administrator to define a Logger for each webapp, and not a logger at the server level. >I wrote a class that does some stuff, I jarred it and I've put it in the >"endorsed" directory. >It is important, for me, that this class is loaded from that directory >(it is not relevant, for the sake of my question, to tell you why; just >take it as a "must"). OK -- but there had better be a very good reason ;) Many server administrators would not add someone else's code to an endorsed codebase. >Well, how can I do to write to the server log from within that class ? Depends how your Loggers are configured. Using swallowOutput and System.out is also an option, as Senor Nielsen mentioned. >More precisely, which "import" and APIs must I use? Since you're in the endorsed classloader, you can't use the Servlet API. That would be the better implementation, but anyways you're using the endorsed classloader, so your solution is non-portable. Consider: Server theServer = Server.getServer(); Service theService = theServer.findService("Standalone"); Container theContainer = theService.getContainer(); Logger theLogger = theContainer.getLogger(); Now you can use theLogger's log(...) methods. All the above classes are in the org.apache.catalina package. The service name depends on your configuration: Standalone is the default. theLogger may be null if you don't have one defined at that container level. In that case, you can drill down in the code to the Host and Connectors. Note that none of this is recommended practice. The Logger classes may go away or change drastically in future releases. The above code may break in future releases. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]